help: trouble with ONLamp's cookbook tutorial / mysql

L

lewcio

I haven't yet touched the tutorial app's code except to change the
database.yml to read:
development:
adapter: mysql
database: cookbook
host: localhost
...

Application starts up fine at http://127.0.0.1:3000

When I try to test http://127.0.0.1:3000/recipe/list I get the
following error:
ActiveRecord::StatementInvalid in Recipe#list
Invalid argument: SELECT * FROM recipes

Yet I'm able to query SELECT * FROM recipes in Eclipse's "Instant SQL"
tool and get the correct results.

What could be the problem? I have read somewhere that it could be that
the ruby mysql driver is outdated. Unfortunately I wasn't able to find
one to install. Any ideas?

running on Win XP:
Eclipse 3.1.1, app launched with WEBrick
Instant Rails 1.0 preview 1
Ruby 1.8.2
MySQL 4.1.9
 
C

Curt Hibbs

------=_Part_2969_21431517.1130334263040
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I haven't yet touched the tutorial app's code except to change the
database.yml to read:
development:
adapter: mysql
database: cookbook
host: localhost
...

Application starts up fine at http://127.0.0.1:3000

When I try to test http://127.0.0.1:3000/recipe/list I get the
following error:
ActiveRecord::StatementInvalid in Recipe#list
Invalid argument: SELECT * FROM recipes

Yet I'm able to query SELECT * FROM recipes in Eclipse's "Instant SQL"
tool and get the correct results.

What could be the problem? I have read somewhere that it could be that
the ruby mysql driver is outdated. Unfortunately I wasn't able to find
one to install. Any ideas?

running on Win XP:
Eclipse 3.1.1, app launched with WEBrick
Instant Rails 1.0 preview 1
Ruby 1.8.2
MySQL 4.1.9


I'm not sure what's going on here. You could try running Instant Rails (
http://instantrails.rubyforge.org/) which comes with the cookbook app
installed as a sample app and see if it works on your machine.

If you decide to try this, you'll have to stop you currently installation o=
f
MySQL before starting Instant Rails since it tries to start its own copy of
MySQL. Also, if you decide to try this, try it first using WEBrick instead
of the built-in Apache web server like this:

From the main menu (click on the "I" button) select:

Rails Applications >> Manage Rails Applications...

then check the checkbox next to the "cookbook" application and click the
button "Start with WEBrick"

Curt

------=_Part_2969_21431517.1130334263040--
 
L

lewcio

Excellent, that worked!
I should have mentioned that I am running Instant Rails and its
Cookbook app. Also, I am using IR's MySQL.

Starting WEBrick with IR (as above) works, whereas before I was
starting WEBrick from within Eclipse.

Thanks Curt!
 
C

Curt Hibbs

------=_Part_6175_32932622.1130347829023
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Excellent, that worked!
I should have mentioned that I am running Instant Rails and its
Cookbook app. Also, I am using IR's MySQL.

Starting WEBrick with IR (as above) works, whereas before I was
starting WEBrick from within Eclipse.


Ahhh...

When you were starting WEBrick from within Eclipse, it was probably not
being run with copy of Ruby included in Instant Rails. The copy of Ruby tha=
t
it used may or may not have had all of the needed Rails packages (or proper
versions of them). Just guessing here, but IR's included Rby does have all
the right stuff (pun intended).

Curt

------=_Part_6175_32932622.1130347829023--
 
L

lewcio

Oh, I didn't realize that Eclipse would have it's own version of Ruby.
A follow-up question, then: would you know how to configure Eclipse to
use IR's Ruby? Or should I just not worry about it and start WEBrick
via IR?
 
C

Curt Hibbs

------=_Part_6347_11494507.1130348996088
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Oh, I didn't realize that Eclipse would have it's own version of Ruby.
A follow-up question, then: would you know how to configure Eclipse to
use IR's Ruby? Or should I just not worry about it and start WEBrick
via IR?



I don't know. I haven't yet used the RDT plugin for Eclipse. I keep meaning
to try it, but haven't yet got around to it.

Curt

------=_Part_6347_11494507.1130348996088--
 
D

Dean Wampler

I haven't tried this yet, but I see that the Eclipse global
preferences (Window menu -> Preferences), under the Ruby section, has
a page to set the Ruby interpreter you want to use. (The Java JDT
plugin has the same capability.)

dean
 
L

lewcio

Right on, it's there.
Interestingly, I'm set to InstantRails\bin\ruby.exe.
It works with Curt's method above nevertheless. Thanks guys.
 
C

Curt Hibbs

------=_Part_7735_2170710.1130355143559
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

It should be InstantRails\ruby\bin\ruby.exe

Right on, it's there.
Interestingly, I'm set to InstantRails\bin\ruby.exe.
It works with Curt's method above nevertheless. Thanks guys.

------=_Part_7735_2170710.1130355143559--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top