Exception Notifier in Rails 2.1

If you have recenlty or are about to Upgrade an existing Rails application to Rails 2.1 (and why wouldn’t you), be aware that your implementation of Exception Notifier might not work due to a scope change in Rails where:

@controller.filter_parameters

Is now protected, therefore the code in Exception Notifier that called it needs to be change as follows :

1
2
   #exclude_raw_post_parameters? ? @controller.filter_parameters(parameters) : parameters
   exclude_raw_post_parameters? ? @controller.send!(:filter_parameters, parameters) : parameters

Utilizing the send method allows you to call the protected method.

Fortunately the Exception Notifier plugin on GitHut has already been updated to accommodate this fix and can be installed by :

1
	./script/plugin install git://github.com/rails/exception_notification.git

NOTE
Exception Notifier (like most plugins) comes with a suite of tests that you should run as part of your build or at the very least whenever you change something as fundamental as the Rails version your using… BTW I did neither of these things and found out the hard way :-/

2 comments

  1. Thanks for this. I had a hard time figuring out exactly what was going on. I appreciate the post.

  2. Thanks for posting this … saved me a ton of time!

Leave a comment