I am using the title helper from the 3.2 edition of the Ruby on Rails Tutorial by Michael Hartl and just realized a snag with the & character showing up in the title as &Amp; instead.
The relevant snippet of code is here Official Sample App 2nd Edition
The problem. I have a School model and am using the School name on the Show view as follows:
<% provide(:title, @school.name) %>
If my School has a & in the name, it is being replaced with &Amp; in the browser title.
Ryan Bates Railscasts site has a similiar title helper that solves this issue this way
but it is using content_for instead of provide.
Trying to adjust the Rails Tutorial helper, but having trouble getting it work properly. Works great expect for this issue.
You can modify the page_title helper and add
html_safeto the output strings so does not convert the ampersands and leaves them intact