# Table naming conventions

**URL:** <https://www.ruby-forum.com/t/table-naming-conventions/73791>\
**Category:** Rails\
**Created:** [October 27, 2006, 2:37am UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791 "2006-10-27T02:37:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpatialDB\_Advisor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@SpatialDB\_Advisor](https://www.ruby-forum.com/u/SpatialDB_Advisor)\
**Post date:** [October 27, 2006, 2:37am UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791/1 "2006-10-27T02:37:20Z")

</div>

Folks,

I am new to rails. I have tried Google searches, checked the tips and  
doco and can’t find the answer to a simple question.

I have a table called “Activity” that I want to rename so I can use  
RubyOnRails but I don’t know whether the plural form should be  
“Activitys” or “Activities”.

Can someone illuminate me on what to do?

regards  
Simon

---

<div class="post-metadata">

**Author:** ![SpatialDB\_Advisor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@SpatialDB\_Advisor](https://www.ruby-forum.com/u/SpatialDB_Advisor)\
**Post date:** [October 27, 2006, 2:47am UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791/2 "2006-10-27T02:47:21Z")

</div>

Hello Simon,

> I am new to rails. I have tried Google searches, checked the tips and  
> doco and can’t find the answer to a simple question.
> 
> I have a table called “Activity” that I want to rename so I can use  
> RubyOnRails but I don’t know whether the plural form should be  
> “Activitys” or “Activities”.

$ script/console  
Loading development environment.

> > “activity”.pluralize  
> > =\> “activities”

so you can name your table ‘activities’ (downcased)

Note that if the pluralization didn’t fit to you, you can change it  
with Inflector (see config/environment.rb explanations)

– Jean-FranÃ§ois.

–  
Ã? la renverse.

---

<div class="post-metadata">

**Author:** ![SpatialDB\_Advisor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@SpatialDB\_Advisor](https://www.ruby-forum.com/u/SpatialDB_Advisor)\
**Post date:** [October 27, 2006, 2:49am UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791/3 "2006-10-27T02:49:21Z")

</div>

On 10/26/06, SpatialDB Advisor [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am new to rails. I have tried Google searches, checked the tips and  
> doco and can’t find the answer to a simple question.
> 
> I have a table called “Activity” that I want to rename so I can use  
> RubyOnRails but I don’t know whether the plural form should be  
> “Activitys” or “Activities”.

Hey Simon! Check this out:

jeremy@ks editors $ ./script/console  
Loading development environment.

> > “activity”.pluralize  
> > =\> “activities”

The Rails console is your new best friend. It’s just the Ruby  
interactive  
shell (irb) with your Rails app already all loaded up for you to play  
with  
interactively.

You can even create classes dynamically and see the results:

> > class Activity \< ActiveRecord::Base; end  
> > =\> nil  
> > Activity.table\_name  
> > =\> “activities”  
> > Activity.columns  
> > =\> [would have the columns here if I had an activities table]

Can someone illuminate me on what to do?

Take yourself out for a beer to celebrate your ./script/console  
discovery.

Best,  
jeremy

---

<div class="post-metadata">

**Author:** ![SpatialDB\_Advisor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@SpatialDB\_Advisor](https://www.ruby-forum.com/u/SpatialDB_Advisor)\
**Post date:** [October 27, 2006, 2:53am UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791/4 "2006-10-27T02:53:21Z")

</div>

On 10/27/06, SpatialDB Advisor [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can someone illuminate me on what to do?

The pluraliser in rails will use activities as the plural version of  
activity.

There is some information on creating custom pluralisations here  
[http://blog.hasmanythrough.com/articles/2006/05/17/pluralizations](http://blog.hasmanythrough.com/articles/2006/05/17/pluralizations)

Hope that helps

---

<div class="post-metadata">

**Author:** ![SpatialDB\_Advisor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@SpatialDB\_Advisor](https://www.ruby-forum.com/u/SpatialDB_Advisor)\
**Post date:** [October 27, 2006, 6:55am UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791/5 "2006-10-27T06:55:04Z")

</div>

To all who replied so promptly: thank you!

I see there are many RubyOnRails books out there.

I am not a database beginner (I have been using Oracle for nearly 20  
years) though I am a Ruby novice. I know enough about web development  
to make a real pro wince! I am at home in most data modelling tools  
(but a UML novice). So, anyone recommend a book or books that will get  
me up and running fast I would be appreciative.

regards  
Simon

---

<div class="post-metadata">

**Author:** ![SpatialDB\_Advisor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@SpatialDB\_Advisor](https://www.ruby-forum.com/u/SpatialDB_Advisor)\
**Post date:** [November 7, 2006, 10:44am UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791/6 "2006-11-07T10:44:42Z")

</div>

Thanks for the suggestions.  
Simon

---

<div class="post-metadata">

**Author:** ![SpatialDB\_Advisor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f4b2a3/32.png) [@SpatialDB\_Advisor](https://www.ruby-forum.com/u/SpatialDB_Advisor)\
**Post date:** [October 27, 2006, 7:14pm UTC](https://www.ruby-forum.com/t/table-naming-conventions/73791/7 "2006-10-27T19:14:04Z")

</div>

Hey Simon, I would highly recommend, at a minimum, getting a copy of  
the PDF both ‘Programming Ruby’ and ‘Agile Web D. with Rails  
2ed’ from [pragmaticprogrammer.com](http://pragmaticprogrammer.com).

Good luck,

-Conrad
