How do I override rails naming conventions? How do I override rails naming conventions? ruby-on-rails ruby-on-rails

How do I override rails naming conventions?


I'm no RoR expert, but did find a possible approach. From the referenced site you can add inflection rule inside the config/initializers/inflections.rb file:

# Add new inflection rules using the following format ActiveSupport::Inflector.inflections do |inflect|  inflect.irregular 'clothing', 'clothes'end


For rails 2.3.2 and maybe 2+, you need to do it a little different:

ActiveSupport::Inflector.inflections do |inflect|    inflect.plural /^(ox)$/i, '\1\2en'    inflect.singular /^(ox)en/i, '\1'    inflect.irregular 'octopus', 'octopi'    inflect.uncountable "equipment"end


Add this in your environment.rb file if you are trying to stop database pluralization

ActiveRecord::Base.pluralize_table_names = false