简体   繁体   中英

Connect Sql server in Ruby on rails

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 environment. Is there any link to set up connection with SQL Server in ROR?

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

使用此链接配置SQL Server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM