Adjust Title Helper in Ruby on Rails Tutorial 3.2 to deal with & properly
Posted
by
memoht
on Stack Overflow
See other posts from Stack Overflow
or by memoht
Published on 2012-10-28T16:57:15Z
Indexed on
2012/10/28
17:00 UTC
Read the original article
Hit count: 239
ruby-on-rails-3.2
|railstutorial.org
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.
© Stack Overflow or respective owner