Rake Abort 错误,除了撞墙之外没有任何答案。如有必要,请重复
我是一个勇敢的小程序员。我五周前开始对 Rails 进行编程,并且在整个过程中我都陷入了同样的错误。事情是这样的。我安装了mysql应用程序,有最新的rails(2.3.5),ruby(1.8.6)和mysql(5.1.40)。
我多次创建了一个非常漂亮的数据库和表格,其中包含 Rails 中的内容,同样的事情只是为了确保。它就在那里。有用。
然后我进入我的database.yml并确保我的登录名/密码root访问数据库是mysql,一切都很好。绿灯。
然后我做了一个 rake db:migrate..
然后我得到了这个
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/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: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
说真的,没有交易..
五周了..
一个家伙要做什么?谢谢!
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/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: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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这相关吗? 回复:部署错误:未定义方法“generate_best_match=”
Is this relevant? Re: Deploying Error: undefined method 'generate_best_match='
注释掉以下行:
ActionController::Routing.generate_best_match = false
尝试在 config/initializers/new_rails_defaults.rb 中
您会丢失 2.3.4 中引入的一些路由更改,但至少它可能会让您的应用程序运行。
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.
这个错误是由于没有使用正确的mySQL版本引起的。就我而言,是 32 位。一旦我安装了 32 位 mySQL,并使用了 32 位 gem,这一切就完美了。
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.