Hello,
I'm trying to follow a book (www.RailsSpace.com). The book was made
with an older version of Rails, but I'm using Rails 3. I've got a
snippet of code in my application helper that is supposed to add a text
field... It does, but it comes out as escaped TEXT on the webpage. Here
is my helper method:
Hello,
I'm trying to follow a book (www.RailsSpace.com). The book was made
with an older version of Rails, but I'm using Rails 3. I've got a
snippet of code in my application helper that is supposed to add a text
field... It does, but it comes out as escaped TEXT on the webpage. Here
is my helper method:
...which looks right, but it's escaped HTML text for some reason. Any
know why?
Rails now has XSS protection built in. You need to tell rails that the
string you've constructed ("#{label} #{form_field}") is safe. One way
of doing this is calling html_safe! on it