SapphireSteel Forum
Welcome, Guest. Please login or register.
May 24, 2013, 07:00:38 AM

Login with username, password and session length
Search:     Advanced search
Welcome to the SapphireSteel forum - for discussion of the Ruby In Steel and Amethyst IDEs
3884 Posts in 800 Topics by 669 Members
Latest Member: m
* Home Help Search Login Register
+  SapphireSteel Forum
|-+  General
| |-+  Ruby In Steel
| | |-+  Using SQL Server with a Rails app
« previous next »
Pages: [1] Print
Author Topic: Using SQL Server with a Rails app  (Read 3154 times)
bsidey
Newbie
*
Posts: 2


« on: January 02, 2008, 06:13:44 PM »

The word is that Ruby on Rails will make my life easier (why do I keep falling for this?). I am a newbie and have searched the forum and FAQ with no luck so be kind to me.
First of all, kudos for putting Ruby inside VS2005. Even though I am having trouble with the tutorial "Using SQL Server with a rails app" the familiarity of the VS IDE definitely helps and ensures that my typos in a command line are not the source of my troubles.

I followed the RIS install and everything reported success. When I went to this tut the troubles began. First off I couldnt connect to SQL Server to create the db. I kept getting "User is not associated with a trusted log in". This is strange because I have been using SQLEXPRESS 2005 for a while now and every other app that I have has no problem accessing my databases. So, I checked my SQL instance config. Enabled TCP and named pipes but still no access under Windows authentication. Finally I changed to mixed mode auth. and set up a new login with SQLServer auth. The connection was then successful.

On to the next step to add a Controller. The script runs but no say_hello_controller is added. It appears that Webrick needs to be running before this script works. But before I could get Webrick to run I had to find and install the file  sqlserver_adapter.rb. (None of this is mentioned in the tutorial). OK now webbrick runs and the say_hello_controller and model is added to the solution explorer in VS. Creating the db table goes smoothly and adding the line scaffold :say_hello is easy enough.
Now when I open a browser and type http://localhost:3000/say_hello I get an error
"NoMethodError in Say helloController#index" 
"undefined method `scaffold' for SayHelloController:Class".
Any clues how I fix this?

Regards bsidey
Logged
Huw Collingbourne
Administrator
Hero Member
*****
Posts: 934



« Reply #1 on: January 03, 2008, 04:44:42 AM »

I followed the RIS install and everything reported success. When I went to this tut the troubles began. First off I couldnt connect to SQL Server to create the db. I kept getting "User is not associated with a trusted log in". This is strange because I have been using SQLEXPRESS 2005 for a while now and every other app that I have has no problem accessing my databases. So, I checked my SQL instance config. Enabled TCP and named pipes but still no access under Windows authentication. Finally I changed to mixed mode auth. and set up a new login with SQLServer auth. The connection was then successful.
First, did you add ADO.rb as explained in the tutorial? This is essential. Next, what OS are you using? The tutorial was done using XP and all kinds of new security restrictions have appeared in Vista. These could be a problem. Finally, which version of Rails? If it's the newly released Rails 2 there may be differences (in which case I may - when I have some free time - need to go back and rewrite the tutorial  Sad ).

The plain fact of the matter is that SQL Server is harder to use with Rails than MySQL. However, if you can check the above details I'll see if I can figure out why you are having these problems. I probably won't have too much time this week I'm afraid for reasons that will become clear shortly (keep watching the blog  Smiley ). However, it is one of our aims to make Ruby/Rails as easy as possible (in my experience, Rails is definitely nowhere near as easy to use as some of its fans would have you believe!) so this is something I will want to look at.

best wishes
Huw
Logged
bsidey
Newbie
*
Posts: 2


« Reply #2 on: January 03, 2008, 09:36:09 PM »

Thanks Huw. Yes I installed ADO.rb and am using XP SP2 and Rails 2.0.2. Don't worry about the sqlexpress issues too much, I am pretty sure the mixed mode auth. in sqlserver security has fixed that.

I have also just read that many others are having difficulty with scaffold as it has been deprecated in Rails 2.0 and is now a plug in. My options are to install the plug in or go back to rails 1.2. The war stories out there suggest that Rails 1.2 has more material for beginners so I will probably do that. The blogs also lead me to think that only the installation of RoR on Windows is hard, and after that it gets easier. I still think RIS Rocks.

Thanks
bsidey
Logged
Huw Collingbourne
Administrator
Hero Member
*****
Posts: 934



« Reply #3 on: January 04, 2008, 04:50:41 AM »

Thanks Huw. Yes I installed ADO.rb and am using XP SP2 and Rails 2.0.2. Don't worry about the sqlexpress issues too much, I am pretty sure the mixed mode auth. in sqlserver security has fixed that.
Still, it would be nicer if this were easier. I'll take another look at this when things are a bit less hectic here.
Quote
I have also just read that many others are having difficulty with scaffold as it has been deprecated in Rails 2.0 and is now a plug in.
Did you notice my tutorial on the Rails 2 scaffold?

http://www.sapphiresteel.com/How-To-Create-A-Blog-With-Rails-2
Quote
My options are to install the plug in or go back to rails 1.2. The war stories out there suggest that Rails 1.2 has more material for beginners so I will probably do that.
My feeling is that Rails 1.2 will be around for a while yet. There is quite a big disincentive to upgrade to a system that may break existing apps and won't work with most tutorials either. Also, most web hosts who support Rails are probably not going to be in a big rush to convert either (and risk breaking their customers' apps).
Quote
The blogs also lead me to think that only the installation of RoR on Windows is hard, and after that it gets easier.
Again, we have a tutorial to help: http://www.sapphiresteel.com/Setting-Up-Ruby-and-Rails-For-Ruby

But, again, we still think this is too much like hard work. We have, in fact, now written an all-in-one installer which we shall release soon and should help people over most (all?) of the setup problems.
Quote
I still think RIS Rocks.
That's nice to hear!  Grin
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!