Overriding Ruby On Rails’s default database naming
Here’s one that took way too long to figure out (mostly because I couldn’t think of a good Google search for what I was looking for). Hope this entry has enough keyword stickiness to help someone else out.
To override ActiveRecord’s default naming schemes (pluralized table names, "id" as the name of the primary key), you can use the following ActiveRecord methods:
set_table_name "MY_TABLE_NAME"
set_primary_key "MY_KEY_NAME"
Those methods should override Ruby on Rails’s default behaviors and let you use your own names for ID/primary key fields and table names.
technorati tags:ruby, on, rails, activerecord, database