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?
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.
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