Ruby On Rails - Collection Select - MYSQL Database - Problem Displaying ampersand ("&")
- by dbkbaki
I am having an annoying problem displaying the labels of a select box
correctly where there is an ampersand contained within the label
string.
On a form being rendered with the form_for helper the
collection_select reads data from a Mysql 5.075 database the text
stored in the database is "Surabaya & Surrounding Areas" when rendered
and displayed in firefox 3.6 or safari is is displaying as "Surabaya
%amp; Surrounding Areas".
The code used to render the select is as follows:
<%= f.collection_select :parent_id, Destination.roots, :id, :name, {:include_blank => true} %>
I have tried adding a h(:name) and also storing && in the database but
it still will not display the ampersand correctly. Have searched on
google for what I thought would be a simple solution but cant find
anything that solves this.
Using ROR 2.3.5/Ruby 1.8.7
If anyone has a solution it will be much appreciated.
many thanks,
David