Skip to content

Instantly share code, notes, and snippets.

@mikebaldry
Created July 14, 2011 08:36
Show Gist options
  • Select an option

  • Save mikebaldry/1082104 to your computer and use it in GitHub Desktop.

Select an option

Save mikebaldry/1082104 to your computer and use it in GitHub Desktop.
Rails 3.1 page titles
app/views/energy/index.html.haml:
-page_title = "Test title"
%h1 energy page
app/views/layouts/application.html.haml:
%title= page_title
app/helpers/application_helper.rb:
def page_title=(value)
content_for(:page_title) { value }
end
def page_title
content_for(:page_title)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment