2
votes

Argh! Everything has been totally fine, then all of a sudden I started getting this error when I was doing a 'rake db:migrate' And I get the same thing when I try to restart the rails server.

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

Confirmation that I'm running a current version: mm-MacBookPro:trunk mm$ rails -v Rails 2.3.5

None of my form_for's were added recently and they were working fine. I rebooted and reinstalled rails. What the heck could cause this?

Here's the --trace

** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! undefined method 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 require' /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 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/engine.rb:1:in <top (required)>' /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 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 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' /Volumes/Development/tc/app/trunk/vendor/plugins/haml/init.rb:5:in rescue in block in evaluate_init_rb' /Volumes/Development/tc/app/trunk/vendor/plugins/haml/init.rb:1:in block in evaluate_init_rb' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin.rb:146:in eval' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin.rb:146:in block in evaluate_init_rb' /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' /Volumes/Development/tc/app/trunk/vendor/rails/railties/lib/rails/plugin/loader.rb:38:in block in load_plugins' /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 process' /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 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' /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:incall' /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:ineach' /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:inblock 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:ininvoke_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:ineach' /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:inblock 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:ininvoke_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 each' /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 block in run' /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 run' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in <top (required)>' /usr/local/bin/rake:19:inload' /usr/local/bin/rake:19:in `'

1

1 Answers

1
votes

This is strange. HAML is fighting with ActionView for some reason. It looks like HAML is loaded before ActionView? Do you have any strange requires in for HAML in your application?

Have you tried upgrading your HAML gem? Could you also try to disable the plugin in config/environment.rb, and then run your rake task?

If you're not using HAML at all, then you could also remove the plugin from vendor/plugins.