Ruby on rails ActionView::Helpers::TagHelper的Rails未定义方法

Ruby on rails ActionView::Helpers::TagHelper的Rails未定义方法,ruby-on-rails,haml,rubinius,Ruby On Rails,Haml,Rubinius,在试生产机器上运行rails时,我遇到一个未定义的方法错误。错误消息如下所示: undefined method `content_tag' for module `ActionView::Helpers::TagHelper' (in /home/user/my-rails-app/app/assets/javascripts/templates/general/test.mustache) kernel/delta/module.rb:39:in `alias_method' haml

在试生产机器上运行rails时,我遇到一个未定义的方法错误。错误消息如下所示:

undefined method `content_tag' for module `ActionView::Helpers::TagHelper'
  (in /home/user/my-rails-app/app/assets/javascripts/templates/general/test.mustache)
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__'
...
错误出现在布局文件中,位于包含“application.js”的行上:

<%= javascript_include_tag "application" %>
我认为此错误是由于加载Haml时,
ActionView::Helpers::TagHelper
模块没有定义
content\u标记。(相关代码为)。由于某些原因,此问题不会出现在其他相同的环境中。是否有人可以建议此问题的修复/解决方案

[更新]


这只发生在开发模式中。我正在使用rbx-2.2.6、actionpack 4.0.2版和haml 4.0.5,最近找到了一个解决办法。如果您确保加载了action视图,然后手动加载haml,它将正常工作

在application.rb中,在需要rails之后,但在需要捆绑gems之前:

require 'action_view'
require 'haml'

多亏了艾萨克的灵感

我在Sinatra应用程序中看到了类似的东西,但只是在生产中:
未初始化常量Haml::ActionView
来自
Haml-4.0.5/lib/Haml/template/plugin.rb:4
。我所需要做的就是
要求'haml/template/plugin'之前要求'action\u view/template/handlers/erb'