I am the intrepid little programmer that could. I began programming rails five weeks ago and I have been stuck on the same error for that entire time. It goes like this. I have mysql application installed, have the latest rails (2.3.5), ruby (1.8.6), and mysql (5.1.40).
I created a perfectly beautiful database and table with content in rails several times, same thing just to make sure. It's there. It works.
Then I go into my database.yml and make sure my login/password root access database is mysql everything good. Green light.
Then I do a rake db:migrate..
and I get this
rake aborted!
undefined method `generate_best_match=' for ActionController::Routing:Module
trace statement
(in /Users/johnsmith/Sites/rails/music_library2)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `generate_best_match=' for ActionController::Routing:Module
/Users/johnsmith/Sites/rails/music_library2/config/initializers/new_rails_defaults.rb:14
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:145:in `load'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:145:in `load'
/Users/johnsmith/.gem/ruby/1.8/gems/rails-2.3.3/lib/initializer.rb:622:in `load_application_initializers'
/Users/johnsmith/.gem/ruby/1.8/gems/rails-2.3.3/lib/initializer.rb:621:in `each'
/Users/johnsmith/.gem/ruby/1.8/gems/rails-2.3.3/lib/initializer.rb:621:in `load_application_initializers'
/Users/johnsmith/.gem/ruby/1.8/gems/rails-2.3.3/lib/initializer.rb:176:in `process'
/Users/johnsmith/.gem/ruby/1.8/gems/rails-2.3.3/lib/initializer.rb:113:in `send'
/Users/johnsmith/.gem/ruby/1.8/gems/rails-2.3.3/lib/initializer.rb:113:in `run'
/Users/johnsmith/Sites/rails/music_library2/config/environment.rb:9
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependencies.rb:156:in `require'
/Users/johnsmith/.gem/ruby/1.8/gems/rails-2.3.3/lib/tasks/misc.rake:4
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/ge开发者_如何学运维ms/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
And seriously, no deals..
For five weeks..
What is a dude to do? Thanks!
Is this relevant? Re: Deploying Error: undefined method 'generate_best_match='
Try commenting out the line:
ActionController::Routing.generate_best_match = false
in config/initializers/new_rails_defaults.rb
You lose some routing changes introduced in 2.3.4, but at least it might get your app running.
This error is caused by not using the correct mySQL version. In my case, 32-bit. Once I installed the 32-bit mySQL, and used the 32-bit gem, this worked perfectly.
精彩评论