ExceptionLogger plugin and Edge (2.0 RC)

I love the ExceptionLogger plugin. And I love developing on Rails Edge (which is currently between 2.0 PR and 2.0 RC). I recently ran into a small headache when trying to get ExceptionLogger to work with a standard EdgeRails setup, and there seemed to be things missing from their README.

Install RedCloth:


sudo gem install redcloth -y

Modify your routes (it seems to me that this was unecessary before the PR):


map.connect logged_exceptions/:action/:id, :controller => logged_exceptions

Get it working with will_paginate. In logged_exceptions_controller, change this:

34
35
@exception_pages, @exceptions = paginate :logged_exceptions, :order => created_at desc, :per_page => 30, 
  :conditions => conditions.empty? ? nil : parameters.unshift(conditions *  and )

to this:

34
35
@exceptions = LoggedException.paginate :order => created_at desc, :per_page => 30, :page => (params[:page] || 1),
  :conditions => conditions.empty? ? nil : parameters.unshift(conditions *  and )

Finally, in the views/logged_exceptions folder in the plugin, there is a partial called _exceptions.rhtml. Replace the if conditionals that reference the old pagination objects with this:

4

50
<%= will_paginate @exceptions %>

<%= will_paginate @exceptions %>

Enjoy!

Leave a Comment