Aug 27

If you have legacy tables which’s impossible to deal with Active Record ( name table is not same with name model, controller), you can setting table name in model :

for example :

set_table_name "review­_feature_7"
set_primary_key "feature_id"

and to create ‘review_id’ become primary key when you create migration, you just put => :primary_key and give :option => “auto_increment=1″ for setting that field become auto increment after create table :

for example :

create_table "review_feature_"+product_space.id.to_s, : primary_key => :feature_id, : options => "auto_increment=1" do |t|
end

Leave a Reply

Security Code: