Created
May 29, 2014 14:01
-
-
Save dstarh/21609c738b52c11f94e2 to your computer and use it in GitHub Desktop.
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
class ApplicationController < ActionController::Base | |
@@page_title = nil | |
def self.set_title(page_title) | |
@@page_title = page_title | |
end | |
def page_title | |
ignore_for = %w{sessions devise} | |
if !ignore_for.include?(params[:controller]) && @@page_title.nil? | |
raise "set_title must be set for #{params[:controller]}##{params[:action]}" | |
end | |
@@page_title | |
end | |
helper_method :page_title | |
end |
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
class ShoppingListController < ApplicationController | |
before_action :authenticate_user! | |
set_title "Shopping List" | |
def index | |
.... | |
end | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment