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
Has anyone any idea about how to approach solving this? (I''m newish to ruby, and MySQL, and totally new to rails). Regards Ian In message <$TzKG6CVAa$BFwhI-XZoyATsUNX5Wk0Htik3J/w@public.gmane.org>, Ian Hobson <Ian-1i7dRvFgrf+SE57U5PDhIQ@public.gmane.org> writes>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 > > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails >-- If you practise error, you do error. If you practice perfectly, you will become perfect. You can''t correct the fast. You can speed up the correct. MM
* Ian Hobson <Ian-1i7dRvFgrf+SE57U5PDhIQ@public.gmane.org> [0202 20:02]:> Has anyone any idea about how to approach solving this? > > (I''m newish to ruby, and MySQL, and totally new to rails).I don''t think the trailing ; is your problem, that should be fairly standard. (You probably shouldnt'' use the same database for devel/prod/test, because test gets walloped if you ever run ''rake'', but does''nt sound like you''ve done that anyway...) Anything untoward in the logs (log/development.log under your main rails dir)? You say you followed along with the article and hit an error, does that mean it worked for a bit (just checking if you''ve ever got data out of the db)?> In message <$TzKG6CVAa$BFwhI-XZoyATsUNX5Wk0Htik3J/w@public.gmane.org>, Ian Hobson > <Ian-1i7dRvFgrf+SE57U5PDhIQ@public.gmane.org> writes > >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.-- ''The State is the kind of organization which, though it does big things badly, does small things badly too.'' -- John Kenneth Galbraith Rasputin :: Jack of All Trades - Master of Nuns
Hi Dick Thanks for responding. In message <20050201231007.GU61488-ljw3OzSR29Le1YwaX0O7wQ@public.gmane.org>, Dick Davies <rasputnik-ogHSZ3ARDZIOXkKaSkYkkl6hYfS7NtTn@public.gmane.org> writes>* Ian Hobson <Ian-1i7dRvFgrf+SE57U5PDhIQ@public.gmane.org> [0202 20:02]: >> Has anyone any idea about how to approach solving this? >> >> (I''m newish to ruby, and MySQL, and totally new to rails). > >I don''t think the trailing ; is your problem, that should be fairly >standard. >I''m inclined to agree.>(You probably shouldnt'' use the same database for devel/prod/test, >because test gets walloped if you ever run ''rake'', but does''nt sound >like you''ve done that anyway...) >Agreed. But not knowing yet how to switch from one to the other, that was away of setting rails to use the database.>Anything untoward in the logs (log/development.log under >your main rails dir)? >Nope. There is nothing in any log except the development one - and that ends with exactly what I would expect Processing RecipeController#New (for 127.0.0.1 at Mon Jan 31 02:53:00 GMT Standard Time 2005) Parameters: {"action"=>"New", "controller"=>"Recipe"} ActionController::UnknownAction (No action responded to New): (This is Correct - there was no action - that is one of the actions in the tutorial. Walkback removed) Rendering d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/tem plates/rescues/layout.rhtml (500 Internal Error) (Then the puzzling entry) Processing RecipeController#new (for 127.0.0.1 at Mon Jan 31 02:53:08 GMT Standard Time 2005) Parameters: {"action"=>"new", "controller"=>"Recipe"} [4;35mRecipe Columns (0.000000) [0;37mInvalid argument: SHOW FIELDS FROM recipes ActiveRecord::StatementInvalid (Invalid argument: SHOW FIELDS FROM recipes): d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/c onnection_adapters/abstract_adapter.rb:384:in `log'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/c onnection_adapters/mysql_adapter.rb:55:in `columns'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/b ase.rb:1163:in `attributes_from_column_definition'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/b ase.rb:782:in `initialize_without_callbacks'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/c allbacks.rb:224:in `initialize'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /scaffolding.rb:118:in `new'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /scaffolding.rb:118:in `new'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /base.rb:607:in `send'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /base.rb:607:in `perform_action_without_filters'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /filters.rb:294:in `perform_action_without_benchmark'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /benchmarking.rb:30:in `perform_action_without_rescue'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /benchmarking.rb:30:in `measure'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /benchmarking.rb:30:in `perform_action_without_rescue'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /rescue.rb:75:in `perform_action'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /base.rb:274:in `send'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /base.rb:274:in `process'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller /base.rb:252:in `process'' d:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/dispatcher.rb:40:in `dispatch'' d:/dev/cookbook/public/dispatch.rb:10 d:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/webrick_server.rb:101: in `load'' d:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/webrick_server.rb:101: in `handle_dispatch'' d:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/webrick_server.rb:80:i n `handle_mapped'' d:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/webrick_server.rb:34:i n `do_GET'' d:/ruby/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `__send__'' d:/ruby/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service'' d:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' d:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' d:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' d:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' d:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' d:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' d:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' d:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' d:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' d:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' d:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.5/lib/webrick_server.rb:19:i n `dispatch'' script/server:49 Rendering d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/tem plates/rescues/layout.rhtml (500 Internal Error)>You say you followed along with the article and hit an error, does >that mean it worked for a bit (just checking if you''ve ever got data >out of the db)? >I only got data out of this mysql database using mysql - and my log shows I was using the same user and password as rails. I had a LOT of problems trying to use a mysql database on another (linux) machine, until I twigged MySQL was only listening to internal ports. It is a firewall. And the external ports are shut down tight. However I can not see how that would be relevant.>> In message <$TzKG6CVAa$BFwhI-XZoyATsUNX5Wk0Htik3J/w@public.gmane.org>, Ian Hobson >> <Ian-1i7dRvFgrf+SE57U5PDhIQ@public.gmane.org> writes >> >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. >
* Ian Hobson <Ian-1i7dRvFgrf+SE57U5PDhIQ@public.gmane.org> [0258 21:58]:> >(You probably shouldnt'' use the same database for devel/prod/test...> Agreed. But not knowing yet how to switch from one to the other, that > was away of setting rails to use the database.You''re best off commenting out the test and production lines, development will still work.> (Then the puzzling entry) > > Processing RecipeController#new (for 127.0.0.1 at Mon Jan 31 02:53:08 > GMT Standard Time 2005) > Parameters: {"action"=>"new", "controller"=>"Recipe"} > [4;35mRecipe Columns (0.000000) [0;37mInvalid argument: SHOW > FIELDS FROM recipes> ActiveRecord::StatementInvalid (Invalid argument: SHOW FIELDS FROM > recipes): > d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/c > onnection_adapters/abstract_adapter.rb:384:in `log'' > d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/c > onnection_adapters/mysql_adapter.rb:55:in `columns'' > d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/b > ase.rb:1163:in `attributes_from_column_definition''> >(just checking if you''ve ever got data out of the db)?> I only got data out of this mysql database using mysql - and my log > shows I was using the same user and password as rails.Hmm, nothing obvious, I''m afraid (I use sqlite or postgres myself). The only thing I can suggest is checking mysqls logs, see if anything jumps up and smacks you in the face.... (do feel free to jump in at any point here, guys... <g>) -- ''With that big new contract, I''ve been able to make those government mandated upgrades you''ve all been suing me about.'' -- Prof. Farnsworth Rasputin :: Jack of All Trades - Master of Nuns