Wednesday, April 16, 2008

Getting Radiant and Exception Notifier to play nice together

I recently had a need to install the Exception Notifier plugin in Radiant.  I used this excellent post from Casper Fabricus to get it working with Radiant, but I wanted to have it included in every controller, even the Radiant ones, not just the ones in our various extensions.

Since Radiant is a gem, you don't have direct access to it's application controller to be able to add the includes.  It took me a little while to figure this out, but I finally hit on adding these lines to the bottom of the library file that Casper creates in his article:

class ActionController::Base
  include ExceptionNotifiable
  alias :rescue_action_locally :rescue_action_in_public
end

This causes Exception Notifier to be available for all controllers, even Radiants'.