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
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.
If it is only specific tables and not all of them
self.pluralize_table_names = false
works well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With