How to get Ruby on Rails to generate a model using sql server 2008
Ruby version: 3.0.2 Rails: 1.9.2 OS: windows 7 DB: sql server 2008 (r2)
I tried to execute the following command: rails generate model product
The error I get can be seen here: pastebin.ca/1965168
I tried to follow these two sites: rubyrailsandwindows.blogspot.com/2008/03/rails-2-and-sql-server-2008-on-windows_24.html
w开发者_开发知识库ww.lostechies.com/blogs/rhouston/archive/2008/05/03/connecting-activerecord-to-sql-server.aspx
I ran the following: gem install activerecord-sqlserver-adapter which appeared to install the gem and i've confirmed that there is an activerecord directory in my ruby installation.
I also ran:gem install dbi-0.4.3
my database.yml file contains the following: adapter: sqlserver mode: odbc dsn: sqlTest_development host: localhost username: sqlTest password: pool: 20 timeout: 50000
If you need any other information please let me know. I've tried other sites but people just tell me I should switch to Linux which isn't very helpful.
why not just use active record? Sorry not as familiar with SQL Server Connection..
:adapter => "sqlserver",
:host => ".\\SQLEXPRESS",
:database => "MyDB",
:username => "sa",
:password => "sa"
here's an example with odbc: http://github.com/aslakhellesoy/activerecord-sqlserver-adapter/blob/master/test/connections/native_sqlserver_odbc/connection.rb
But I think this link to the actual gem will help the most: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Platform-Installation---Windows
I am sorry to say, that the guide from 2008 is to old... ( sqlserver adapter no longer needs dbi ) As Nick said: go to wiki of activerecord adapter on Github
精彩评论