Connecting a Rails app on Windows to SQL Server

(1) For this to work properly, first you need to install the DevKit.
Just download the executable from RubyInstaller and run it. For rails 2 choose 3.4.5 version.

If it’s installed on C:DevKit, for example, then follow the next steps:
cd C:DevKit
ruby dk.rb init
ruby dk.rb install
gem install rdiscount --platform=ruby

(2) Install the ruby-odbc gem for accessing ODBC data sources:

c:>gem install ruby-odbc

(3) Install the activerecord-sqlserver-adapter gem. Be sure to install the same version of your Rails framework. You have more info about it here.

c:>gem install activerecord-sqlserver-adapter --version=2.3.11

(4) Create an ODBC data source. If you’re running a 64 bit Windows System, don’t use the ODBC Administrator Tool from the Control Panel because a 64 bit ODBC data source won’t work. Instead, open the 32 bit ODBC Administrator Tool this way:

c:>cd C:WindowsSysWoW64
c:>odbcad32.exe

Select a default database on your DSN. Select English as the default language, although you’re not using English (I had problems with date formats using Spanish).

(5) Edit the config/database.yml configuration file:

development:
adapter: sqlserver
mode: ODBC
dsn: your-odbc-data-source-name
host: your-sql-server-host
username: an-sql-username
password: the-username-password

If you have any problems with Decimal numbers just change the decimal type to float on your migration files, and recreate your database.

Source: http://franciscojsaez.tumblr.com/post/4550243496/connecting-a-rails-app-on-windows-to-sql-server