The Hitchhiker’s Guide to Ruby On Rails Galaxy

Records of my voyage through RoR Galaxy

Model name in RubyOnRails should ALWAYS be singular!!!

Posted by arjunghosh on December 23, 2008

Model names in RubyOnRails should be Singular. This will create Table name as corresponding Plural names.

You have got to remember that about model naming conventions in rails. . 

I know this is a very basic concept in RubyOnRails but sometimes these simple basic concepts are the ones which slip through the cracks.

Example:

> ruby script/generate model Post

This will create a Model by the name “Post” i.e. singular in english language and a migration to create a table by the name “Posts” which is plural form of “Post”.

I have even put this into a pastie for easier remembarance http://pastie.org/345491

About these ads

7 Responses to “Model name in RubyOnRails should ALWAYS be singular!!!”

  1. Catherine Shorrock said

    Great blog to read thanks.

  2. Alexis said

    Hey – whats up. Thanks for the blog. I’ve been digging around looking some info up for shool, but there is so much out there. Yahoo lead me here – good for you i suppose! Keep up the good work. I will be popping back over in a couple of days to see if there is any more info.

  3. Clifford Feigel said

    Thanks for the post! People are crazy for not using more Twitter.

  4. chat said

    Thanks for the post! People are crazy for not using more Twitter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: