Skip to content

Instantly share code, notes, and snippets.

@ovoice
Created February 24, 2010 16:55
Show Gist options
  • Save ovoice/313611 to your computer and use it in GitHub Desktop.
Save ovoice/313611 to your computer and use it in GitHub Desktop.
def title_tag(title_string)
controller_str = controller.controller_name.capitalize! || 'Home'
action_str = controller.action_name.capitalize || 'Index'
title_string.gsub("%controller%",controller_str).gsub("%action%",action_str)
content_tag(:title,title_string)
end
#source from http://blog.wetherubyists.com/post/396588375/handling-title-tags-in-rails
<%= title_tag("The Rubyists | %controller% > %action%") %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment