jfisk
jfisk

Reputation: 6205

Why isnt my application_helper.rb helping?

Im doing Michael Hartl's excellent tutorial series on ruby on rails here: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

and im having an issue in 4.1.1, where he refactors the title of the pages to rely on application)helper.rb to set the tag. Ive done exactly what he said in the book, and for some reason it never seems to kick in. Each title of my page has the name given in the @title variable in pages_controller.rb or if i omit it i will get some sort of controller error displayed where the title should be. My code is at github:

https://github.com/ekimia/mTwitter

Thanks for helping a Ruby on Rails newbie out.

Upvotes: 2

Views: 392

Answers (1)

tybro0103
tybro0103

Reputation: 49713

In app/views/layouts/application.html.erb change <%=@title%> to <%=title%>.

If you prepend the "@" then it will try to access the variable @title which would be set in the controller. Without the "@" it will call the title method (or helper rather), which you defined in app/helpers/application_helper.rb

Upvotes: 3

Related Questions