Permalink
Browse files

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.
  • Loading branch information...
1 parent 48cf433 commit 192a49a02d63d28b23ed41cebadfedd490929cf1 @sickill sickill committed Aug 25, 2010
@@ -40,7 +40,7 @@ def exception_notification(env, exception)
@env = env
@exception = exception
@options = (env['exception_notifier.options'] || {}).reverse_merge(self.class.default_options)
- @controller = env['action_controller.instance'] || MissingController.new
+ @kontroller = env['action_controller.instance'] || MissingController.new
@request = ActionDispatch::Request.new(env)
@backtrace = clean_backtrace(exception)
@sections = @options[:sections]
@@ -50,7 +50,7 @@ def exception_notification(env, exception)
instance_variable_set("@#{name}", value)
end
- prefix = "#{@options[:email_prefix]}#{@controller.controller_name}##{@controller.action_name}"
+ prefix = "#{@options[:email_prefix]}#{@kontroller.controller_name}##{@kontroller.action_name}"
subject = "#{prefix} (#{@exception.class}) #{@exception.message.inspect}"
mail(:to => @options[:exception_recipients], :from => @options[:sender_address], :subject => subject) do |format|
@@ -1,4 +1,4 @@
-A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @controller.action_name %>:
+A <%= @exception.class %> occurred in <%= @kontroller.controller_name %>#<%= @kontroller.action_name %>:
<%= raw @exception.message %>
<%= raw @backtrace.first %>
@@ -10,4 +10,4 @@ A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @co
"#{title}\n\n#{summary.gsub(/^/, " ")}\n\n"
end
end %>
-<%= raw sections.join %>
+<%= raw sections.join %>

9 comments on commit 192a49a

@jinzhu
Contributor
jinzhu commented on 192a49a Sep 7, 2010

nice, I found this problem resolved just after I fixed it in my local and going to push it. ;-0

@matthewrudy
Contributor

Yeah,
I was about to use sickill's branch myself.
But its now in the official repo.

Thanks.

@sunaku
sunaku commented on 192a49a Sep 7, 2010

Note that the README still mentions @controller. It should be updated accordingly.

@fesplugas

Can you push the latest Gem version to rubygems.org?

@jinzhu
Contributor
jinzhu commented on 192a49a Oct 19, 2010

actually I also prefer a gem version.

@matthewrudy
Contributor

same here.
thanks

@fesplugas

Gem is not still updated in Rubygems. To use the gem from git on your Gemfile use the following snippet:

gem 'exception_notification', :git => 'https://github.com/rails/exception_notification.git', :require => 'exception_notifier'
@matthewrudy
Contributor

someone has already packaged this as a nice freestanding gem

gem "exception_notification_rails3", :require => "exception_notifier"
@fesplugas

Good solution. ;-)

Please sign in to comment.