I am getting an undefined method error when running rails on a preproduction machine. The error message looks like this:
undefined method `content_tag' for module `ActionView::Helpers::TagHelper'
(in /home/user/my-rails-app/app/assets/javascripts/templates/general/test.mustache)
The error appears in the layout file, on the line that includes 'application.js':
<%= javascript_include_tag "application" %>
The stacktrace looks like this:
kernel/delta/module.rb:39:in `alias_method'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:74:in `__script__'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:59:in `__script__'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:38:in `__script__'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:1:in `__script__'
kernel/common/code_loader.rb:243:in `require'
kernel/common/kernel.rb:705:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:214:in `load_dependency'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
haml (4.0.5) lib/haml/template.rb:3:in `__script__'
kernel/common/code_loader.rb:243:in `require'
kernel/common/kernel.rb:705:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:214:in `load_dependency'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
haml (4.0.5) lib/haml/railtie.rb:5:in `__script__'
kernel/common/eval.rb:43:in `instance_eval'
activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:28:in `on_load'
kernel/bootstrap/array.rb:66:in `each'
activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:27:in `on_load'
haml (4.0.5) lib/haml/railtie.rb:4:in `__script__'
...
I believe this error is due to the fact that the ActionView::Helpers::TagHelper
module does not have content_tag
defined at the time that Haml is loaded. (The relevant code is here). For some reason, this issue does not appear in other identical environments. Can anyone suggest a fix/workaround for this issue?
[UPDATE]
This only happens in development mode. I am using rbx-2.2.6, actionpack version 4.0.2, and haml 4.0.5