5.3.2 of Hartl Ruby on Rails

Today was so frustrating. I am halfway through Chapter 5 and followed the instructions word for word. It’s been mostly a review (for me anyway) of CSS and HTML.

When I ran $bundle exec rake test in section 5.3.2 Rails Routes, I kept getting 4 errors. The error message was:Unnamed QQ Screenshot20150709113038

So the error messages were pretty clear, right? My web pages are saying “Ruby on Rails Tutorial Sample App | About” instead of “About | Ruby on Rails Tutorial Sample App”. I just couldn’t figure out how to fix it and where the error was coming from.

Finally, while sitting in an iOS workshop this evening, it hit me. The only piece of code that I copied and pasted into my application was from my previous blog post that I had found on Stack Overflow. Coming back home, I opened up the page and lo and behold, there was my error!

The error was located in the app/helpers/application_helper.rb file.

I had to change this:

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

To this:

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

SO SIMPLE!

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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