I finally got it working after a lot of googeling around big thanks
to
http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Platform-Installation---Windows
for pointing me towards ruby-odbc which was the final peice to solve
my puzzle
How to get Ruby on Rails working with MS SQLServer2008 and windows
server 2003
This mini tutorial assumes MS SQLServer2008 is installed and running i
will be using mongrel to deploy
1. Install ruby via
www.rubyinstaller.org (i used 1.8.7 version)
2. Install the DevKit (otherwise all gems won´t install properly)
3. Start a command promt with ruby via the start menu
4. Install rails
gem install rails
5. Get a cup of coffee this will take a while
6. install mongrel
gem install mongrel --pre (2010-10-27 this was the way to do it, this
will change)
7. install ruby-odbc
gem install ruby-odbc
8. install activerecord-sqlserver-adapter
gem install activerecord-sqlserver-adapter
9. install dbi
gem install dbi
10. install rails-dbi
gem install rails-dbi
NOTE: the reason for installing rails dbi and putting gem 'rails-
dbi', :require => 'dbi' in the gem file
is a conflict with the dbi and the deprecated gems. This issue migth
be resolved in the future.
11. Now its time to get on with editing our gemfile
put this in it
gem 'rails-dbi', :require => 'dbi'
gem 'ruby-odbc'
gem 'activerecord-sqlserver-adapter'
gem 'mongrel', '1.2.0.pre2' #this line will probably change in the
future this is written 2010-10-27
Then you need a connection string this will be in your config/
database.yml file
development:
adapter: sqlserver
driver: Sql Client
mode: odbc
database: DatabaseName
host: localhost/SQLSERVER2008
dsn: dsn_name
autocommit: true
username: user
password: pass
NOTE:
# localhost migth suffice or if you have mutilple named instances like
me you have to include that as well
About dsn:
the dsn is created via the Data Sources(ODBC) tool under
administrative tools
Create a System DSN with the same name as dsn: dsn_name under client
configuration use TCP/IP(this should be default just adding this so
you know that this is correct)
now try to create a new project and a scaffold do a bundle install and
rake db:migrate if all went well you should be able to start your
server via rails server and start doing som CRUD against your
SQLServer2008 database
> > <
rubyonrails-talk%2Bunsu...@googlegroups.com<
rubyonrails-talk%252Buns...@googlegroups.com>