Reputation: 2984
I would like to have a multiple sign '×' inside a link_to helper in my Rails 3 app.
Straightforward code <%= link_to '×', model, :confirm => 'Sure?', :method => :delete %>
outputs ×
on my page. How to fix it?
Upvotes: 14
Views: 6367
Reputation: 17247
To prevent your string from being "made safe" by Rails' output buffer:
<%= link_to '×'.html_safe, model, :confirm => 'Sure?', :method => :delete %>
Footnote
In my own pages, I encode everything as UTF-8, which means that I can use the real Unicode characters directly, rather than use the &...; code, but this probably isn't an option for you if you didn't start your project with that intent.
Upvotes: 34