[Rails] Yet MORE configuration problems
Ian Hobson
Ian at ianhobson.co.uk
Mon Jan 31 03:03:49 GMT 2005
Hi
I thought I damaged my ruby/rails install so I started again on a new
machine. Fresh install of windows 2000, Apache PHP MySQL PHPMyAdmin,
(fixed the password with old_password()), ruby and rails. All latest
versions this weekend.
Followed along Curt Hibbs ONLamp article - but I have arrived at an
error I cannot solve.
After putting scaffold :recipe into recipe_controller, I get
ActiveRecord::StatementInvalid in Recipe#index
Invalid argument: SELECT * FROM recipes
My d:/dev/cookbook/config/database.yml file contains...
development:
adapter: mysql
database: rails_test
host: localhost
username: rails
password: sea4island
test:
adapter: mysql
database: rails_test
host: localhost
username: rails
password: sea4island
production:
adapter: mysql
database: rails_test
host: localhost
username: rails
password: sea4island
To give you the data, this is a session from mysql
D:\Program Files\MySQL\MySQL Server 4.1\bin>mysql -h localhost -u rails
-psea4island
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 84 to server version: 4.1.9-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use rails_test
Database changed
mysql> select * from recipes;
+----+--------------+---------------+
| id | name | method |
+----+--------------+---------------+
| 0 | First Recipe | Boil that egg |
+----+--------------+---------------+
1 row in set (0.00 sec)
mysql> show fields from recipes;
+--------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+----------------+
| id | int(11) | | PRI | NULL | auto_increment |
| name | varchar(255) | | | | |
| method | text | YES | | NULL | |
+--------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
mysql>
The URL http://localhost:3000/Recipe gives me ....
ActiveRecord::StatementInvalid in Recipe#index
Invalid argument: SELECT * FROM recipes
script/server:49
Show framework trace
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/conne
ction_adapters/abstract_adapter.rb:384:in `log'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/conne
ction_adapters/mysql_adapter.rb:132:in `select'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/conne
ction_adapters/mysql_adapter.rb:44:in `select_all'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/base.
rb:327:in `find_by_sql'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/base.
rb:320:in `find_all'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sca
ffolding.rb:103:in `list'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/sca
ffolding.rb:96:in `index'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/bas
e.rb:607:in `send'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/bas
e.rb:607:in `perform_action_without_filters'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/fil
ters.rb:294:in `perform_action_without_benchmark'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/ben
chmarking.rb:30:in `measure'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/ben
chmarking.rb:30:in `perform_action_without_rescue'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/res
cue.rb:75:in `perform_action'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/bas
e.rb:274:in `send'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/bas
e.rb:274:in `process'
d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/bas
e.rb:252:in `process'
d:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/dispatcher.rb:40:in
`dispatch'
http://localhost:3000/recipe/new gives a similar error, complaining
about
show fields from recipe
It appears to me that these SQL statements are valid - if they had a
trailing ; to terminate them.
Ideas anyone? (Before I wipe rails from my machine for good this time).
Regards
Ian
More information about the Rails
mailing list