Search code examples
ruby-on-railsrubyactiverecordmodelpluralize

Ruby on Rails ActiveRecord: pluralization


I'm new to Rails, so forgive my ignorance of ActiveRecord. One of my models is named "campus". I ran the migration and it pluralized everything except "campus".

I thought that was lame so I added the code to the environment config to leave everything singular.

I deleted the tables, manually edited the migration files to use singular forms, and re-ran the migrations. Now my associations to "campus" no longer work. I ran it through the console and noticed that I'm getting an uninitialized constant "Campu". So something still thinks "campus" is plural? Should I assume that config change will cause me nothing but trouble going forward?


Solution

  • Use custom inflections. See this related question: How do I override rails naming conventions?