exceptionz

Thoughts on Technology, Methodology and Programming.

Rails scaffold method problems (actually connection)

Posted by Marcus Wyatt on 1 November 2006

I’m trying out Ruby in Steel the past week and where pulling my hair out because the scaffold method did not work. The database was hosted on a SQL2005 server and I did not think you need to do anything special to use Ruby in Steel against SQL.

So after a couple of hours trying to solve the problem, I decided to try my project against a MySQL database and scaffold worked. So I figured that there must be a problem with rails connecting to the sql database.

If you get the following message “identical test/fixtures/posts.yml is not a class/module” when running script/generate scaffold, then you have a problem connecting to the sql database (that’s of course if you using sql as your data store).

I found a solution to the SQL2005 connection problem on a fellow wordpress blog.

Just in ram posted the following:

It appears rails does not connect to MS SQL Server right out of the box. You need to do the following to get the connection to work:

NOTE: These instructions are a tweaked version of http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServer

Get the latest source distribution of Ruby-DBI and copy the file:

bdi-0.1.0/lib/dbd/ADO.rb

to:

c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb

NOTE: The ADO directory does not exist on a standard install, you will need to create it.

Then simply set up your railsapp/config/database.yml

Here’s an example for reference:

development:
  adapter: sqlserver
  database: database_name
  host: server_name
  username: user_name
  password: your_pw_here

Thanx… just in ram

Advertisements

One Response to “Rails scaffold method problems (actually connection)”

  1. Thanks for the interest in Ruby In Steel. We actually supply ADO.rb in the download archive and its use with SQL Server is documented in the readme file. I accept, however, that not everyone reads the readme 😉 and we plan to add more db diagnostics as we move towards the Developer edition of the software.

    In the meantime, you may find our tutorial on creating a Rails-based blog with Ruby In Steel to be of some use. This comes with a 20 minute movie and a 30 page step-by-step PDF user guide which goes through every step of the way using both MySQL and SQL Server:

    http://www.sapphiresteel.com/Create-a-Weblog-With-Ruby-In-Steel

    We also have a fairly extensive PDF manual for Ruby In Steel. This doesn’t go into as much detail regarding database configuration issues, however, and I’ll make a note to add more information in the next revision:

    http://www.sapphiresteel.com/The-Ruby-In-Steel-User-Guide

    best wishes
    Huw

    http://www.sapphiresteel.com
    Ruby Programming For Visual Studio 2005

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: