Table naming conventions

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

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.

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

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

Hope that helps

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

Hey Simon, I would highly recommend, at a minimum, getting a copy of
the PDF both 'Programming Ruby' and 'Agile Web Development with Rails
2ed' from pragmaticprogrammer.com.

Good luck,

-Conrad

Thanks for the suggestions.
Simon