Skip to content

Commit 192a49a

Browse files
author
Marcin Kulik
committed
Use @kontroller instead of @controller
Accessing @controller var in view shows deprecation warning and is treated as try to access current controller instance which in this case is ExceptionNotifier::Notifier instance - not what we need.
1 parent 48cf433 commit 192a49a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/exception_notifier/notifier.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def exception_notification(env, exception)
4040
@env = env
4141
@exception = exception
4242
@options = (env['exception_notifier.options'] || {}).reverse_merge(self.class.default_options)
43-
@controller = env['action_controller.instance'] || MissingController.new
43+
@kontroller = env['action_controller.instance'] || MissingController.new
4444
@request = ActionDispatch::Request.new(env)
4545
@backtrace = clean_backtrace(exception)
4646
@sections = @options[:sections]
@@ -50,7 +50,7 @@ def exception_notification(env, exception)
5050
instance_variable_set("@#{name}", value)
5151
end
5252

53-
prefix = "#{@options[:email_prefix]}#{@controller.controller_name}##{@controller.action_name}"
53+
prefix = "#{@options[:email_prefix]}#{@kontroller.controller_name}##{@kontroller.action_name}"
5454
subject = "#{prefix} (#{@exception.class}) #{@exception.message.inspect}"
5555

5656
mail(:to => @options[:exception_recipients], :from => @options[:sender_address], :subject => subject) do |format|

lib/exception_notifier/views/exception_notifier/exception_notification.text.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @controller.action_name %>:
1+
A <%= @exception.class %> occurred in <%= @kontroller.controller_name %>#<%= @kontroller.action_name %>:
22

33
<%= raw @exception.message %>
44
<%= raw @backtrace.first %>
@@ -10,4 +10,4 @@ A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @co
1010
"#{title}\n\n#{summary.gsub(/^/, " ")}\n\n"
1111
end
1212
end %>
13-
<%= raw sections.join %>
13+
<%= raw sections.join %>

0 commit comments

Comments
 (0)