Created
February 14, 2009 20:55
-
-
Save neerajsingh0101/64471 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| include HoptoadNotifier::Catcher | |
| around_filter :ensure_page_title | |
| def ensure_page_title | |
| yield | |
| response_is_redirect = (response.status.to_i >= 300) && (response.status.to_i < 400) | |
| request_format_is_html = request.format.to_s == 'text/html' | |
| if request_format_is_html && @page_title.blank? && !response_is_redirect && request.get? && !(%w(admin captcha).include?(params[:controller])) | |
| if Rails.env.development? | |
| raise "@page_title is missing" | |
| else | |
| HoptoadNotifier.notify( | |
| :error_class => "page_title_missing", | |
| :error_message => "page title missing", | |
| :request => { :params => params, | |
| :url => "#{request.protocol}#{request.host_with_port}#{request.request_uri}"} | |
| ) | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment