# File lib/hoptoad_notifier/rails/controller_methods.rb, line 37 def hoptoad_filter_if_filtering(hash) return hash if ! hash.is_a?(Hash) if respond_to?(:filter_parameters) filter_parameters(hash) rescue hash else hash end end
# File lib/hoptoad_notifier/rails/controller_methods.rb, line 14 def hoptoad_local_request? if defined?(::Rails.application.config) ::Rails.application.config.consider_all_requests_local || request.local? else consider_all_requests_local || local_request? end end
# File lib/hoptoad_notifier/rails/controller_methods.rb, line 28 def hoptoad_request_data { :parameters => hoptoad_filter_if_filtering(params.to_hash), :session_data => hoptoad_filter_if_filtering(hoptoad_session_data), :controller => params[:controller], :action => params[:action], :url => hoptoad_request_url, :cgi_data => hoptoad_filter_if_filtering(request.env) } end
# File lib/hoptoad_notifier/rails/controller_methods.rb, line 55 def hoptoad_request_url url = "#{request.protocol}#{request.host}" unless [80, 443].include?(request.port) url << ":#{request.port}" end url << request.fullpath url end
# File lib/hoptoad_notifier/rails/controller_methods.rb, line 47 def hoptoad_session_data if session.respond_to?(:to_hash) session.to_hash else session.data end end
This method should be used for sending manual notifications while you are still inside the controller. Otherwise it works like HoptoadNotifier.notify.
# File lib/hoptoad_notifier/rails/controller_methods.rb, line 8 def notify_hoptoad(hash_or_exception) unless hoptoad_local_request? HoptoadNotifier.notify(hash_or_exception, hoptoad_request_data) end end