Rails use MS SQL server database

2020-07-14 05:56发布

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.

1条回答
手持菜刀,她持情操
2楼-- · 2020-07-14 06:19

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:

As an alternative to ActiveRecord altogether, you might consider DataMapper as it claims to work better with "brownfield" (i.e. already established) databases.

查看更多
登录 后发表回答