<%=content_tag :h2, :header do-%>
<%=yield(:page_title).html_safe?-%>
<%=yield(:page_title).titleize-%>
<%- end -%>
What exactly does yield(:page_title) return before you titleize it?
Fred
<%-content_for :page_title,
"a boy & his dog"
-%>
So the issue would seem to be that content_for is escaping the & (turning it into &), and then titleize, not knowing any better uppercases the & to &Amp. Character entities are case sensitive so this screws things up. Why not call titleize in the content_for block?
So the issue would seem to be that content_for is escaping the &
(turning it into &), and then titleize, not knowing any better
uppercases the & to &Amp. Character entities are case sensitive so
this screws things up. Why not call titleize in the content_for block?
Thank you Fred. Yes, that works. I did not think to do that because
our practice is to apply styling methods at the moment of display. On
this page I can change that without difficulty but on others, as the
text is sometimes used in multiple places on a page, I may not be so
fortunate as in this example.