Reputation: 13333
My project doesn't use the plural convention in table's names. How can I override this convention without calling set_table_name in all my ActiveRecord class
Upvotes: 5
Views: 852
Reputation: 261
If it is only specific tables and not all of them
self.pluralize_table_names = false
works well.
Upvotes: 2
Reputation: 1931
You have to create an initializer in your rails project like this:
# file: config/initializers/active_record_extensions.rb
ActiveRecord::Base.pluralize_table_names = false
This will make all your table names singular by default on your models.
Upvotes: 7