I am very new to rails, and from what i have been reading and watching in tutorials only helps me build things from scratch, creating new databases and the models at the same time.
my company has an accounting / construction project management software system that was recently warehoused into ms sql server.
how would i build the models from the existing tables structure . i开发者_运维问答m not needing delete update. im looking to create a remote web based querying tool.
thanks.
Connecting Rails to SQL server is a separate issue which has been covered a bit by some previous stackoverflow questions.
You can generate models corresponding to your existing tables in the same way as you would for new tables and then use a number of methods to handle places where your existing table and field names don't follow Rails naming conventions. e.g. if you create a Project
model then Rails would expect the table to be called projects
(plural). If your table was called project
you would need to add to your model:
class Project < ActiveRecord::Base
set_table_name "project"
end
Similarly, if the primary key for your table was project_id
rather than just id
you could do:
class Project < ActiveRecord::Base
primary_key = 'project_id'
end
you can use sql manager to create the database.
rails use sqlite3 by default.
精彩评论