module Redmine::Reporting::Rails::ControllerMethods
Public Class Methods
included(base)
click to toggle source
# File lib/redmine/reporting/rails/controller_methods.rb, line 6 def self.included(base) base.class_eval do helper_method :redmine_report_reference_id end end
Public Instance Methods
redmine_reporting_request_data()
click to toggle source
# File lib/redmine/reporting/rails/controller_methods.rb, line 12 def redmine_reporting_request_data { :params => redmine_reporting_filter_hash(params.to_hash), :session => redmine_reporting_filter_hash(session.to_hash), :controller => params[:controller], :action => params[:action], :url => redmine_reporting_request_url } end
Protected Instance Methods
redmine_report(subject_or_exception, options={}, &block)
click to toggle source
This method should be used for sending manual notifications while you are still inside the controller. Otherwise it works like Redmine::Reporting.report
.
# File lib/redmine/reporting/rails/controller_methods.rb, line 26 def redmine_report(subject_or_exception, options={}, &block) unless redmine_reporting_local_request? @redmine_reporting_reference_id = env['redmine_reporting.reference_id'] = Redmine::Reporting.report(subject_or_exception, options, &block) end end
redmine_report_reference_id()
click to toggle source
# File lib/redmine/reporting/rails/controller_methods.rb, line 32 def redmine_report_reference_id @redmine_reporting_reference_id || env['redmine_reporting.reference_id'] end
Private Instance Methods
redmine_reporting_filter_hash(hash)
click to toggle source
# File lib/redmine/reporting/rails/controller_methods.rb, line 42 def redmine_reporting_filter_hash(hash) return hash if ! hash.is_a?(Hash) ActionDispatch::Http::ParameterFilter.new(::Rails.application.config.filter_parameters).filter(hash) end
redmine_reporting_local_request?()
click to toggle source
# File lib/redmine/reporting/rails/controller_methods.rb, line 38 def redmine_reporting_local_request? ::Rails.application.config.consider_all_requests_local || (request.local? && (!request.env["HTTP_X_FORWARDED_FOR"])) end
redmine_reporting_request_url()
click to toggle source
# File lib/redmine/reporting/rails/controller_methods.rb, line 48 def redmine_reporting_request_url url = "#{request.protocol}#{request.host}" url << ":#{request.port}" unless [80, 443].include?(request.port) url << request.fullpath url end