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
on 2006-03-27 08:30
on 2006-03-27 09:24
On 3/27/06, Prashant Tiwari <firstname.lastname@example.org> 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'