Tuesday, 17 September 2013

How to escape HTML entities inside array in Ruby on Rails?

How to escape HTML entities inside array in Ruby on Rails?

I am trying to populate a select box with options from an array and escape
those options so currency symbols lile € get displayed rather than €.
How can this be done in Ruby on Rails?
This is my function:
def options
array = []
array << ["&dollar;", "some value"]
array << ["&euro;", "some value"]
end
And this is the form:
<%= f.select(:format, f.object.options) %>
I tried things like array.html_safe but unfortunately it's not working.
Thanks for any help.

No comments:

Post a Comment