Forum: Ruby on Rails Naming conventions for models on older database????

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.
Prashant T. (Guest)
on 2006-03-27 10:30
Hi,

I am using RoR for my web development. But Database is already created
(Older database) with its own table name without RoR Specificcations.
Table names are:-
blacklist_patterns
category
comment
moderation
store
vote

What will be names for models corresponding to my above tables? If I
want to specify my own names to models? Can I do it? If yes then How?

Please tell me.
Thanx in advance.
Prash
Wilson B. (Guest)
on 2006-03-27 11:24
(Received via mailing list)
On 3/27/06, Prashant T. <removed_email_address@domain.invalid> wrote:
> vote
>
> What will be names for models corresponding to my above tables? If I
> want to specify my own names to models? Can I do it? If yes then How?
>

You can name your models however you wish, and use the
"set_table_name" method to specify this.
class Comment < ActiveRecord::Base
  set_table_name 'comment'
end

One further piece of trickery: currently, your unit test fixtures need
to be named after the actual table, rather than after the model.
So, put your comment fixtures in comment.yml, and refer to them with
'fixtures :comment'
This topic is locked and can not be replied to.