Naming Convemtion for Model?

Hi,
In My database there is a table called “categories”. Now what name
should I specify for my model as per ruby naming convention? Is it
“Category”???
Also is it possible to keep database table name singular instead of
plural?
Please tell me.
Thanx in advance.
Prash

Prashant T. wrote:

Hi,
In My database there is a table called “categories”. Now what name
should I specify for my model as per ruby naming convention? Is it
“Category”???
Also is it possible to keep database table name singular instead of
plural?
Please tell me.
Thanx in advance.
Prash

The model would be called Category.
Then in the model you can set the name using:
set_table_name “category”

Or if you want this for all models, put the following line in your
environmen.rb:
ActiveRecord::Base.pluralize_table_names = false

Joey__

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs