Any method accessible to the views directly has to go to the helper.
Since you are trying to access this method in your layouts, put your code in the application_helper.rb
file.
All helpers are modules only.
If you don't have the file, create one in app/helpers
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
Then, include ApplicationHelper
in application_controller.rb