Last active
September 27, 2015 06:17
-
-
Save acook/1224384 to your computer and use it in GitHub Desktop.
Set your page title to a sane default.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will set your Page Title to a sane default | |
# | |
# Usage: | |
# Put this in your ApplicationHelper. | |
# Call `title` in your view or layout to display a default title. | |
# You can set `@title` in your controller action to change the default title. | |
def title | |
if @title then | |
@title | |
elsif params[:action] == 'index' | |
params[:controller].titleize | |
else | |
"#{params[:action]} #{params[:controller].gsub('devise/', '')}".titleize.singularize | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment