umamahesh_nyros

Joined: 17 Jul 2007 Posts: 224 Location: KAKINADA
|
Posted: Tue May 19, 2009 3:42 pm Post subject: setting a custom table name for a model |
|
|
Hello developers,
By fallowing Active Record "Convention over Configuration" you can create software with few bugger faster. rails default fallows a convention such as, tables have artificial primary key called "id" and foreign keys for tables are the table name fallowed by id.
in some situations we may need to overwrite the model name to user defined one. this can be done by "set_table_name" statement in your model.
":set_table_name" my_custom_table_name" tells ActiveRecord that you want a table named my_custom_table_name.
Thank You,
Uma. |
|