I have a client asking me to help them build a ruby application to interface with a database that was created for a different application that runs on php. The problem is that since the database was not scaffolded with rails, it does not follow any of the rails conventions. For example, there is a table called form
If I run the command rails generate model form
then rails will infer the table name is forms
further more I don't want ruby to perform any migrations since the data is already there in the state that I want it. Is there any good way of going about this?
You don't need to run migrations to have the model. Either skip them (--no-migration
) or remove the file after generating. As for table names, look at table_name=
. primary_key=
may also be handy.
class Form << ActiveRecord::Base
self.table_name = 'form'
end