Chapter 5 of Michael Hartl’s guide

I’m working on Chapter 5 of the Michael Hartl guide Ruby on Rails Tutorial and I have this error when running the rails server:

undefined method `full_title'

On this line of code in the application.html.erb page:

 <title><%= full_title(yield(:title)) %></title>

Found a solution on StackOverflow that solved the error:

def full_title(page_title)
  base_title = "Ruby on Rails Tutorial Sample App"
  if page_title.empty?
    "#{base_title} | #{page_title}"

I had to define the full_title method in the application_helper.rb page. (Why the helper page?) And then add this to the application_controller.rb page:

include ApplicationHelper


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s