I'm working on a simple plugin here, and this far it is working.
Except my helper.
Its a very simple helper, it just needs to echo a <span></span>
for later javascript parsing.
The problem is, its not rendering the html correcty, its replacing special chars by the html equivalent code.
My plugin initializer:
ActionView::Helpers.send :include, Test
My plugin helper:
module Test
def only_for_testing
render(:text => "<span></span>")
end
end
When I call the only_for_testing helper inside the view, instead of rendering the "<span></span>"
it renders "<span></span>
"
I tryed remove the render, return only the string, same effect. I really dont want to create a partial for this, because its a very very simple html, and its not for layout, its just for parsing.
Any idea what i may have done wrong here?
Rails 3 escapes HTML by default in the view. You need to use the raw() helper or "HTML string here".html_safe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With