Geego cms - content mangement system - website management

Publishing data grids to Active Record models

When a data grid needs to be sorted or partialy displayed or otherwise manipulated on display it is normaly best to publish it to an Active Record model.

You can then retrieve the grid from the data base in the usual fashion using Active Record.

Publish to Active Record setup


1. Create the database table.

Create your table named as you wish with the following compulsory fields:

t.column :g_block_id, :integer
t.column :g_language_id, :string, :limit=>5
t.column :position, :integer
t.column :updated_at, :datetime
or
g_block_id int not null default 0,
g_language_id char(5) null,
position int not null,
updated_at datetime not null

and the following optional field:

t.column :repeater_name, :string
or
repeater_name varchar(255)

(only needed if have different repeaters on same page/block using the same model)

2. Create your Active Record model for that table.

3. Add model to template definition.
In your repeater/grid definition (template definition file) give the repeater the following attribute where String is the Model name as a string:

:publish_model=> [String]