Connect Sql server in Ruby on rails

后端 未结 1 1538
别那么骄傲
别那么骄傲 2021-01-19 03:19

I am newbie to ruby on rails. I want to know how to connect Sql server to the rails application.

Iam working with RoR in windows environmen

相关标签:
1条回答
  • 2021-01-19 03:52

    I haven't done it on Windows, but if it's anything like connecting to postgresql on a mac you have to:

    1. Have sql-server running locally (http://msdn.microsoft.com/en-us/library/ms143219.aspx ?)
    2. Add a gem to your gemfile that will allow Rails to talk to sql-server, probably this: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter | gem 'activerecord-sqlserver-adapter', '~> 3.1.0'
    3. Update your database.yml file for sql server, example here: Setting up Rails to work with sqlserver (plus it's also the answer)
    4. Then you would just create the db and migrate it. On a mac it's like this rake db:create && rake db:migrate
    0 讨论(0)
提交回复
热议问题