3

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 . im not needing delete update. im looking to create a remote web based querying tool.

thanks.

2 Answers 2

5

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
Sign up to request clarification or add additional context in comments.

Comments

-1

you can use sql manager to create the database.

rails use sqlite3 by default.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.