Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 774
divz Avatar asked Oct 05 '22 20:10

divz


1 Answers

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
like image 55
AdamT Avatar answered Oct 12 '22 16:10

AdamT