Ruby on Rails
Turn

It would be nice if there was an option to disable the pluralization in the heuristic used to map Ruby class names to database table names. This can be undesirable:

This seem to be enough:


def (ActiveRecord::Base).table_name
name # or whatever transformation you want.
end

If you want to change the default for just a group of classes you can do:

for c in [MyClass,Other,Other2]
def c.table_name
name #or whatever
end
end

GabrieleRenzi

Alternatively, you can turn it all off at once using this code:

ActiveRecord::Base.pluralize_table_names = false

It works if put in the “Environment Specific Configuration” section of /config/environment.rb .

You can also specify an irregular pluralisation, allowing specific naming conventions, eg
Inflector.inflections do |inflect|
inflect.irregular ‘taxon’, ‘taxa’
end

However, I have found no way of allowing tables to be named “databases” or “references” – I had to rename them to get the script\generate scaffold to work.