如何将erb转换为html?

Dav*_*ala 3 ruby-on-rails erb templating

想象一下,在 rails 中,我有@template一个ActionTemplate::View.

问题是:我怎样才能将@template@template.source转换<%= "hello from erb" %>hello from erb?? 谢谢

Kyl*_*yle 5

尝试这个...

ERB.new(@template.source).result
Run Code Online (Sandbox Code Playgroud)

ERB#new