模块`ActionView :: Helpers :: FormHelper'的未定义方法`form_for'

时间:2010-02-07 20:02:48

标签: ruby-on-rails ruby

哎呀! 一切都很好,然后突然间,当我做一个'rake db:migrate'时,我开始收到这个错误 当我尝试重启rails服务器时,我得到同样的东西。

rake aborted!
undefined method 'form_for' for module `ActionView::Helpers::FormHelper'

确认我正在运行当前版本: mm-MacBookPro:trunk mm $ rails -v Rails 2.3.5

我最近没有添加任何form_for,而且它们工作正常。 我重新启动并重新安装了rails。到底能造成什么呢?

这是--trace

  

**调用db:migrate(first_time)   **调用环境(first_time)   **执行环境耙中止! undefined方法form_for' for module ActionView :: Helpers :: FormHelper'   /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml/helpers/action_view_mods.rb:174:in   alias_method' /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml/helpers/action_view_mods.rb:174:in ”   /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml/helpers/action_view_mods.rb:159:in   <module:Helpers>' /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml/helpers/action_view_mods.rb:41:in ”   /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml/helpers/action_view_mods.rb:1:in   <top (required)>' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 需要”   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in   block in require' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in new_constants_in'   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in   require' /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml/helpers.rb:2:in ”   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in   需要require' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 阻止   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in   new_constants_in' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 需要”   /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml/engine.rb:1:in   <top (required)>' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 需要”   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in   block in require' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in new_constants_in'   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in   require' /Users/mm/.gem/ruby/1.9.1/gems/haml-2.2.19/lib/haml.rb:40:in”   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in   需要require' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 阻止   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in   new_constants_in' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 需要”   /Volumes/Development/tc/app/trunk/vendor/plugins/haml/init.rb:5:in   evaluate_init_rb中的rescue in block in evaluate_init_rb' /Volumes/Development/tc/app/trunk/vendor/plugins/haml/init.rb:1:in 阻止   /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin.rb:146:in   evaluate_init_rb中的eval' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin.rb:146:in 阻止   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in   silence_warnings' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin.rb:142:in evaluate_init_rb”   /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin.rb:48:in   load_plugins中的load' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin/loader.rb:38:in 阻止   /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin/loader.rb:37:in   each' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin/loader.rb:37:in load_plugins'   /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/initializer.rb:348:in   load_plugins' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/initializer.rb:163:in 过程   /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/initializer.rb:113:in   run' /Volumes/Development/tc/app/trunk/config/environment.rb:13:in ”   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in   需要require' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 阻止   /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in   new_constants_in' /Volumes/Development/tc/app/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in 需要”   /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/tasks/misc.rake:4:in   block in <top (required)>' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in称之为”   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in block in execute' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in每个'   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in阻止invoke_with_call_chain'   /usr/local/lib/ruby/1.9.1/monitor.rb:190:in   mon_synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain'   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:607:in block in invoke_prerequisites' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in每个'   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:596:in阻止invoke_with_call_chain'   /usr/local/lib/ruby/1.9.1/monitor.rb:190:in   mon_synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain'   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task'   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in   block (2 levels) in top_level' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in 每个”   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in   block in top_level' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling”   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in   top_level' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in 阻止运行'   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in   standard_exception_handling' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in 运行”   /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in   <top (required)>' /usr/local/bin/rake:19:in负载”   / usr / local / bin / rake:19:在''

1 个答案:

答案 0 :(得分:1)

这很奇怪。由于某种原因,HAML正在与ActionView作斗争。它看起来像是在ActionView之前加载HAML?您的申请中对HAML有任何奇怪的要求吗?

您是否尝试过升级HAML宝石?您是否也可以尝试在config/environment.rb中禁用该插件,然后运行您的佣金任务?

如果你根本不使用HAML,那么你也可以从vendor/plugins删除该插件。