Hi,
Am getting the error “undefined method `each’ for #Mysql:0x483f2d0”
when I try to run a “rake db:migrate” on a very simple example for a
Mysql database. This follows a very basic setup procedure that works
with sqlite3, but fails when I try to use Mysql (note that I have
verified that the db on mysql is created and accessible to rails)
rails photos
cd photos
ruby script/generate scaffold photo filename:string thumbnail:string description:string
rake db:migrate
at this point I get an error (see below). Note that the
schema_migrations table is created and if I run the rake command then
the table photos is also created (but I get a command out of sequence
error from rails).
I have read relevant posts regarding versions of mysql and
libmysql.dll which I have taken action on.
I would appreciate any clues as it is driving me nuts %).
I am using:
MS Windows XP Home Ediition Version 2002 SP3
ruby ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
rails 2.2.2
mysql gem 2.7.3
Mysql 5.1.31-community
Cheers
Barry
The trace is as follows:
C:\rails\photos>C:\rails\photos>rake db:migrate --trace
(in C:/rails/photos)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
undefined method each' for #<Mysql:0x483f2d0> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/mysql_adapter.rb:414:in
tables’
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/schema_statements.rb:330:in
initialize_schema_migrations_table' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ migration.rb:430:in
initialize’
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
migration.rb:394:in new' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/ migration.rb:394:in
up’
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
migration.rb:377:in migrate' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake: 111 C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in
call’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in execute' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in
each’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in execute' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in
invoke_with_call_chain’
C:/Ruby/lib/ruby/1.8/monitor.rb:242:in synchronize' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in
invoke_with_call_chain’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in invoke' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in
invoke_task’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
top_level' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
each’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in
top_level' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
standard_exception_handling’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in
top_level' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in
run’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
standard_exception_handling' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in
run’
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
C:/Ruby/bin/rake:19:in `load’
C:/Ruby/bin/rake:19