I spent a while to find a solution for connecting Rails 4 with MS SQL Server database. Later I found a quick and easy solution via tiny_tds for my Ubuntu platform.
The gem tiny_tds is a good replacement for RubyODBC/unixODBC/iODBC/AnyODBC.
Step 1: Simply tidy_tds and activerecord-sqlserver-adapter into your Gemfile
gem ‘activerecord-sqlserver-adapter’, git: ‘email@example.com:nextgearcapital/activerecord-sqlserver-adapter.git’, :branch => “rails-4”
Step 2: Edit config/database.yml to map your SQL Server database locations
Step 3: Install free tds (for Ubuntu only).
Install free tds from http://www.freetds.org/.
Extract downloaded tgz file and do
sudo make install
Step 4: Do bundle install on your rails 4 web app and run your Rails application.
Thats it. Enjoy.
Connect Rails 4 With Microsoft SQL Server Database
31 sec read