[Rails] Re: Wierd ActiveRecord Error - different table name shown

Eric Anderson eric at afaik.us
Sat Jan 8 04:34:26 GMT 2005


boonhoo wrote:
> however, my model (and table name) is called Person. Where did the
> 'people' table comes from? I don't find it in the controller code
> (copied exactly from the howto)

Rails automatically pluralizes model names when looking for tables. This 
makes sense because you have many (plural) records in a table. :) If you 
want to change the default behavior you will need to put the following 
in your environment.rb file:

ActiveRecord::Base.pluralize_table_names = false

NOTE: this will change it for all models.

Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://one.textdrive.com/pipermail/rails/attachments/20050107/f4412191/signature.bin


More information about the Rails mailing list