All components of the Rails Connector are provided ready-to-run. In addition, various interfaces are provided to enable you to adjust the software according to your requirements.
There are interfaces to extend and replace parts of the following components:
CmsController
, SearchController
)CmsHelper
, SearchHelper
)Obj
modelThe controller classes of the Rails Connector are extendable by means of inheritance. The CmsController
class, for example, is a sub-class of RailsConnector::DefaultCmsController
and thus inherits all of its behavior. The CmsController
class implements no additional functionality but merely acts as a placeholder for your custom code.
In order to adjust the behavior of the CMS controller, create the file app/controllers/cms_controller.rb
in your application. Then copy the following code and paste it into the file:
<code>class CmsController < RailsConnector::DefaultCmsController # Your custom code end
The hierarchy of the Rails Connector's helper modules is similar to that of the controller classes. There is, for example, a CmsHelper
module that uses the functionality of the DefaultCmsHelper
module but does not add any functionality to it. In order to add or replace CMS helper methods, create the file app/helpers/cms_helper.rb
in your application with the following content:
module CmsHelper include RailsConnector::DefaultCmsHelper # Your custom code end
You can replace the Rails Connector's default views. If you wish to do so, please refer to the corresponding section, Customize Rails Connector Views.
Obj
ModelUp to version 6.8.1, on initialization, the Rails Connector looks for a module named ObjExtensions
in your application code. If it exists, its method enable
is called. You can use this mechanism to add custom functionality to the Obj
model. To do so, create a file named obj_extensions.rb
in your application and start off with the following code:
module ObjExtensions def self.enable Obj.class_eval do # Your own method definitions end end end
Starting at version 6.8.2, the Obj
model can be created and extended in the application. The model needs to inherit from RailsConnector::BasicObj
.
# app/models/obj.rb class Obj < RailsConnector::BasicObj # Define your methods here end