# Rails naming convention for model: community

**URL:** <https://www.ruby-forum.com/t/rails-naming-convention-for-model-community/61221>\
**Category:** Rails\
**Created:** [May 22, 2006, 2:07am UTC](https://www.ruby-forum.com/t/rails-naming-convention-for-model-community/61221 "2006-05-22T02:07:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 22, 2006, 2:07am UTC](https://www.ruby-forum.com/t/rails-naming-convention-for-model-community/61221/1 "2006-05-22T02:07:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 22, 2006, 2:26am UTC](https://www.ruby-forum.com/t/rails-naming-convention-for-model-community/61221/2 "2006-05-22T02:26:05Z")

</div>

On 5/21/06, Sam D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 22, 2006, 3:26am UTC](https://www.ruby-forum.com/t/rails-naming-convention-for-model-community/61221/3 "2006-05-22T03:26:39Z")

</div>

> 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:

[Peak Obsession](http://api.rubyonrails.com/classes/Inflector/Inflections.html)

Also, if you’re unsure about how a word will be pluralized/  
singularized, try Geoffrey Grosenbach’s Pluralizer:

[http://nubyonrails.com/tools/pluralize](http://nubyonrails.com/tools/pluralize)

– Michael D.

---

<div class="post-metadata">

**Author:** ![samonderous](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3da27b/32.png) [@samonderous](https://www.ruby-forum.com/u/samonderous)\
**Post date:** [May 22, 2006, 3:35pm UTC](https://www.ruby-forum.com/t/rails-naming-convention-for-model-community/61221/4 "2006-05-22T15:35:43Z")

</div>

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](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
