@@ -9,8 +9,8 @@ class EmailNotifier < BaseNotifier
99 attr_accessor ( :sender_address , :exception_recipients ,
1010 :pre_callback , :post_callback ,
1111 :email_prefix , :email_format , :sections , :background_sections ,
12- :verbose_subject , :normalize_subject , :delivery_method , :mailer_settings ,
13- :email_headers , :mailer_parent , :template_path , :deliver_with )
12+ :verbose_subject , :normalize_subject , :include_controller_and_action_names_in_subject ,
13+ :delivery_method , :mailer_settings , : email_headers, :mailer_parent , :template_path , :deliver_with )
1414
1515 module Mailer
1616 class MissingController
@@ -60,7 +60,7 @@ def background_exception_notification(exception, options={}, default_options={})
6060
6161 def compose_subject
6262 subject = "#{ @options [ :email_prefix ] } "
63- subject << "#{ @kontroller . controller_name } ##{ @kontroller . action_name } " if @kontroller
63+ subject << "#{ @kontroller . controller_name } ##{ @kontroller . action_name } " if @kontroller && @options [ :include_controller_and_action_names_in_subject ]
6464 subject << " (#{ @exception . class } )"
6565 subject << " #{ @exception . message . inspect } " if @options [ :verbose_subject ]
6666 subject = EmailNotifier . normalize_digits ( subject ) if @options [ :normalize_subject ]
@@ -142,10 +142,10 @@ def initialize(options)
142142 options [ :mailer_settings ] = options . delete ( mailer_settings_key )
143143
144144 options . reverse_merge ( EmailNotifier . default_options ) . select { |k , v |[
145- :sender_address , :exception_recipients ,
146- :pre_callback , :post_callback ,
147- :email_prefix , :email_format , :sections , :background_sections ,
148- :verbose_subject , :normalize_subject , :delivery_method , :mailer_settings ,
145+ :sender_address , :exception_recipients , :pre_callback ,
146+ :post_callback , :email_prefix , :email_format ,
147+ :sections , :background_sections , :verbose_subject , :normalize_subject ,
148+ :include_controller_and_action_names_in_subject , :delivery_method , :mailer_settings ,
149149 :email_headers , :mailer_parent , :template_path , :deliver_with ] . include? ( k ) } . each { |k , v | send ( "#{ k } =" , v ) }
150150 end
151151
@@ -201,6 +201,7 @@ def self.default_options
201201 :background_sections => %w( backtrace data ) ,
202202 :verbose_subject => true ,
203203 :normalize_subject => false ,
204+ :include_controller_and_action_names_in_subject => true ,
204205 :delivery_method => nil ,
205206 :mailer_settings => nil ,
206207 :email_headers => { } ,
0 commit comments