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 8162677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:48:08+00:00 2026-06-06T18:48:08+00:00

I am running through the Rails Tutorial by Michael Hartl (Screen Cast). Ran into

  • 0

I am running through the Rails Tutorial by Michael Hartl (Screen Cast). Ran into the and issue in chapter 4 on the title helper.

I have been putting my own twist on the code as I go to make sure I understand it all. However on this one I it is very similar and I am not quite sure why it is acting the way it is.

Here is the code:

Application.html.erb

<!DOCTYPE html>
<html>
  <head>
    <%- Rails.logger.info("Testing: #{yield(:title)}") %>
    <title><%= full_title(yield(:title)) %></title>
    <%= stylesheet_link_tag    "application", :media => "all" %>
    <%= javascript_include_tag "application" %>
    <%= csrf_meta_tags %>
  </head>
  <body>
    <%= yield %>
  </body>
</html>

Application_helper.rb

module ApplicationHelper
  def full_title(page_title)
    full_title = "Ruby on Rails Tutorial App"
    full_title += " | #{page_title}" unless page_title.blank?
  end
end

Home.html.erb

<h1><%= t(:sample_app) %></h1>
<p>
  This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application
</p>

about.html.erb

 <% provide(:title, t(:about_us)) %>
 <h1><%= t(:about_us) %></h1>
 <p>
   The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> is a project to make a book and screencast to teach web development with <a href="http://railstutorial.org/">Ruby on Rails</a>. This is the sample application for the tutorial.
 </p>

What Happens: The code works fine when I set the provide method like on the about page. However when I do not it does not seem to even call the helper. I am assuming that because no title is passed back. Any ideas on what I am doing wrong?

Thank you all for your help.

Edit:
This is the fix. Thanks to Paul for pointing out that the last line was returning nothing and was why my code was not working. Changed it so it return something not mater the case.

Application_helper.rb

module ApplicationHelper
  def full_title(page_title)
    full_title = "Ruby on Rails Tutorial App"
    page_title.present? ? (full_title += " | #{page_title}") : full_title
  end
end
  • 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-06T18:48:11+00:00Added an answer on June 6, 2026 at 6:48 pm

    I seems you have an issue with the last line of your full_title helper method as it doesn’t return anything if the page_title is blank (all that happens is that local variable full_title gets assigned). Try changing it back to how it is written in the book and see if it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running through Michael Hartl's Rails Tutorial . I'm trying to verify the title
Possible Duplicate: Can't convert String into integer in ruby/ruby-on-rails I'm running through a tutorial
I'm working through Michael Hartl's Ruby on Rails tutorial on http://ruby.railstutorial.org . I'm having
Running my finished Rails Tutorial app through Rails Best Practices got me a warning
I'm working my way through Agile Web Development with Rails and am running into
Going through Lynda's 2010 tutorial on rails and have been stuck on migration for
I'm running through the Ruby on Rails Tutorial 3, and having a ball doing
In running through the basic rails tutorial section about outputting comments, I get the
I'm going through Ruby on Rails Up and Running by O'Reilly and have run
(Using Hartl's Tutorial) I went through chapter 3 without any problems using rspec to

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.