Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8739741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:59:49+00:00 2026-06-13T10:59:49+00:00

I am using the title helper from the 3.2 edition of the Ruby on

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:59:50+00:00Added an answer on June 13, 2026 at 10:59 am

    You can modify the page_title helper and add html_safe to the output strings so does not convert the ampersands and leaves them intact

    def full_title(page_title)
      base_title = "Ruby on Rails Tutorial Sample App"
      if page_title.empty?
        base_title.html_safe
      else
        "#{base_title} | #{page_title}".html_safe
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a helper method from the rails tutorial which concatenates two strings together
I am trying to test a Rails app using Michael Hartl's tutorial, but I
is possible to rename the node title using the value from the java script
In a Rails 3.2 app I define the page title using <% title Title
Im using this PHP to get a list of Title's from an RSS feed:
I'm trying to convert a form from synchronous to asynchronous using the Ajax.BeginForm helper
Through rspec (I'm using rspec-1.3.0, rspec-rails-1.3.2 gems) generator ( ruby script/generate rspec_model suggestion section_id:integer
Is it possible to set the Screen Title using a shell script? I thought
I am trying to change my ipad apps button title programatically using the following
friends, i have created custom title bar using following titlebar.xml file with code <?xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.