For pages created using Fiona and Rails, two database tables are used: released content is stored in a table named
INSTANCENAME_objs, and the draft versions (or the released version if no draft version exists) are stored in a table named
INSTANCENAME_preview_objs. If a CMS object has a committed version (and no draft version), it is considered a draft version.
Using the editing panel of Fiona 7, editors can easily switch between the published content and the draft versions. Technically, this causes the queried table to be switched. This takes place in the context of HTTP requests, meaning that all code that fetches data from the database via the Fiona Connector is provided with the proper data.
The rules for this switching read: If the ID of the selected workspace is
rtc, and if the user has been successfully authenticated against the CMS, the
INSTANCENAME_preview_objs table is used. Otherwise,
INSTANCENAME_objs is used.
If you are working on the Rails console or use scripts, the workspace to use needs to be specified first. In the standard configuration setting (no matter whether the mode is
published workspace is preselected. This makes it possible to fetch published content, but not to manipulate data. So, if you wish to work with the draft versions, the
rtc workspace needs to be selected first. This can be done using
Scrivito::Workspace.use('rtc'), for example.
There is an important point that needs to be observed in
legacy mode: Often, the APIs of the Scrivito SDK and of the Fiona Connector are used mixedly. You can specify the table to use in the Fiona Connector configuration (using
development mode, it is sensible and common practice to have the Fiona Connector initially use the
INSTANCENAME_preview_objs table and thus the
published workspace. This may cause unexpected effects when running scripts and working on the console.
It is best practice to choose a proper configuration that doesn't leave room for surprises. Please be aware of the fact that such a configuration applies to the Rails console and scripts only. It does not affect editorial work or the content displayed to visitors.
In the development environment (
development in Rails), the
RailsConnector::Configuration.mode should be set to
:editor. Furthermore, when running scripts or working on the console,
Scrivito::Workspace.use('rtc') should always be issued. The environment for the editorial system should be configured identically.
For the productive live system, the standard configuration is usually sufficient, meaning that
RailsConnector::Configuration.mode is set to
Scrivito::Workspace.use('published') is executed implicitly.
If no difference is made between the live and the editorial system, the configuration for the editorial system should be used.