In my rails app, I need to use an existing MS SQL database. I have tried following this manual:
http://rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
I do not know how to do models, scaffolds, etc because rails cannot simply use another db. I didn't want to run rake db:migrate for my tables in the MS SQL database. What else do I need to write in the model? If simple: use tables from the MS SQL server's database, but I also want to solve problem with migrations, etc.
If you need to run your Rails up on top of the existing database and you want to make sure you can create all models that match existing tables, follow this guide:
config.active_record.schema_format = :sql
) and just use SQL Server tools to generate SQL file of the database schema and preserve it as db/structure.sql
As an alternative to ActiveRecord altogether, you might consider DataMapper as it claims to work better with "brownfield" (i.e. already established) databases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With