Skip to content

Instantly share code, notes, and snippets.

@stammy
Created April 26, 2011 08:42
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stammy/941997 to your computer and use it in GitHub Desktop.
Save stammy/941997 to your computer and use it in GitHub Desktop.
rails 3 pretty page titles. no more instance vars all up in your controllers
module ApplicationHelper
# pretty page titles
# yield_for(:title, 'default text goes here') in layout
# content_for(:title, 'some text') in view
def yield_for(content_sym, default)
output = content_for(content_sym)
output = default if output.blank?
output
end
end
@stammy
Copy link
Author

stammy commented Apr 26, 2011

rails 3 friendly version of ryan bates's pretty page titles from 2007 http://railscasts.com/episodes/30-pretty-page-title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment