I'm using a helper method from the rails tutorial which concatenates two strings together for use in the title selector in the view. It works perfectly fine, unless there is an apostrophe in the string.
When :group_name contains an apostrophe it comes out like this:
<title>The website | O&#x27;Malley Brothers</title>
Here is the method: app/helpers/application_helper.rb
module ApplicationHelper
def full_title(page_title)
base_title = "Chicago Improv Festival"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
end
Here is how it's used in the layout view. app/views/layouts/application.html.erb:
<title><%= full_title(yield(:title)) %></title>
Here is where the :title is set in another view file: app/views/submissions/show.html.erb
<% provide(:title, @submission.group_name) %>