开发者

Rails HAML engine rendering

开发者 https://www.devze.com 2023-01-23 06:37 出处:网络
What is wrong here? H开发者_JAVA百科aml::Engine.new(\'= image_tag(\"golfer.png\")\').render image_tag is always undefined (ActionView::Helpers in not loaded).

What is wrong here?

H开发者_JAVA百科aml::Engine.new('= image_tag("golfer.png")').render

image_tag is always undefined (ActionView::Helpers in not loaded). How can I fix that? Thx!


I think I found the solution.

  class TagHelper
    include Singleton
    include ActionView::Helpers::TagHelper
    include ActionView::Helpers::AssetTagHelper
  end

  puts Haml::Engine.new('= image_tag("golfer.png")').render(TagHelper.instance)
0

精彩评论

暂无评论...
验证码 换一张
取 消