Forum: Ruby on Rails Regarding Database convention

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Santosh R. (Guest)
on 2007-04-27 10:57
Hi,

  I have a database which have table named with different convention, It
is not following rubyonrails convention that table name must be pural.

How to create model for these table which will not follow convention.

please help me regarding this
Rafael G. (Guest)
on 2007-04-27 11:33
Santosh R patil wrote:
> Hi,
>
>   I have a database which have table named with different convention, It
> is not following rubyonrails convention that table name must be pural.
>
> How to create model for these table which will not follow convention.
>
> please help me regarding this

You can create model with script/generate model. Then in model:

class Foobar < ActiveRecord::Base
  set_table_name "no_conventional_table_name"
  set_primary_key "no_conventional_primary_key_id"   # if needed
end

Regards!
This topic is locked and can not be replied to.