Skip to content

Instantly share code, notes, and snippets.

@neerajsingh0101
Created February 14, 2009 20:55
Show Gist options
  • Select an option

  • Save neerajsingh0101/64471 to your computer and use it in GitHub Desktop.

Select an option

Save neerajsingh0101/64471 to your computer and use it in GitHub Desktop.
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