Hello,
How does Rails deal with the pluralization of community. I have
“community”
as my model name. Will Rails automatically look for a table name
“communities” or do I have to name the table “communitys”?
Thanks.
Hello,
How does Rails deal with the pluralization of community. I have
“community”
as my model name. Will Rails automatically look for a table name
“communities” or do I have to name the table “communitys”?
Thanks.
On 5/21/06, Sam D. [email protected] wrote:
Hello,
How does Rails deal with the pluralization of community. I have “community”
as my model name. Will Rails automatically look for a table name
“communities” or do I have to name the table “communitys”?
Rails will look for a table named communities. Rails knows about most
correct English pluralizations. I believe this is a Ruby library.
How does Rails deal with the pluralization of community. I have
“community”
as my model name. Will Rails automatically look for a table name
“communities” or do I have to name the table “communitys”?
“community” will become “communities” when pluralized. You may want
to have a look at the documentation for Rails’ inflector:
Also, if you’re unsure about how a word will be pluralized/
singularized, try Geoffrey Grosenbach’s Pluralizer:
http://nubyonrails.com/tools/pluralize
– Michael D.
The pluralisations are done with a load of regular expressions in the
inflections.rb file (have a gander:
http://dev.rubyonrails.org/svn/rails/tags/rel_1-1-2/activesupport/lib/active_support/inflections.rb).
You can add others to individual projects by changing environments.rb.
Just look at the commented out bit for an example.
-Nathan
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs