"you will make life easier for yourself if you stick to the Rails
conventions for capitalisation and underscores."

Actually I was trying to do that.  My boss told me (he is also a
newbie) that table names start with a capital letter, though I cannot
find documentation to that effect.
If you can point me to any references to naming conventions I would
appreciate it, thanks.

I start each table with "tc_" because I am coming from Drupal where
all tables of all modules are in one database and this is necessary to
prevent name conflicts.

All help is greatly appreciated.  -Fred


On May 18, 8:32 am, Colin Law <[email protected]> wrote:
> On 18 May 2011 15:37, fredrated <[email protected]> wrote:
>
> > According to 'Agile web development with rails' "... a model is
> > automatically mapped to a database table whose name is the plural form
> > of the model's class".  Sure enough, when I created migrations for
> > 'Tc_project', 'Tc_employee' and 'Tc_period' the migration files issue
> > a 'create table' with the table names pluralized.  However, when I
> > issue "Rails generate scaffold Tc_data..." the create table statement
> > in the migration DID NOT pluralize 'tc_data' to 'tc_datas'!
>
> > Does anyone know if this will create a 'convention' problem between
> > model and table references for the table 'Tc_data'?
> > Unless I hear otherwise I will assume Rails knows what it is doing and
> > run the migration as-is and proceed as if nothing is out of the
> > ordinary.  If Rails chokes on this I will post a reply to my own
> > question.
>
> As Tim has pointed out, this should be datum for the singular and data
> for the plural.  I would also point out that you will make life easier
> for yourself if you stick to the Rails conventions for capitalisation
> and underscores.  In this case the class would be something like
> TcDatum and the table tc_data (or something completely different if
> you do not like datum).  Similarly I would change the names of the
> other classes you mention.
>
> Colin
> Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to