Changing the Table Name Convention
April 20th, 2010
Rails has a convention of making the table names plural, and a model names singular. For example, if a model name is Order then database table name will be Orders.
This convention is great most of the time but what about if you have a legacy database table and you wanted to port the application onto Rails. Fortunately, there is a solution. You can easily change this convention, by setting set_table_name table name in the model.
For Example:
class Order < ActiveRecord::Base
set_table_name "legacy_order"
end