You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason controller is nil is that the before hook on line 8 in action_controller/caching/sweeper.rb, which assigns the current controller to the @controller instance variable, is not called on the first request.
We were able to work around this issue in our app with the following addition to our ApplicationController.
I've tested this on the new Rails 3 branch (discussed in #30) and cannot get the same behavour (luckily). Should we attempt to fix this on the old branch or are you fine with documenting it as a caveat in that branch's readme ?
This happens in an app that uses acts_as_audited and relies on
controller.current_user
to provide the user to theAudit
record. Steps to reproduce:The
audit
record has no user.This is happening because on line 28 of audit_sweeper.rb, the
controller
is nil.The reason
controller
is nil is that thebefore
hook on line 8 inaction_controller/caching/sweeper.rb
, which assigns the current controller to the@controller
instance variable, is not called on the first request.We were able to work around this issue in our app with the following addition to our
ApplicationController
.VERSIONS:
rails-2.3.5
acts_as_audited-1.1.1
ree-1.8.7-2010.01
The text was updated successfully, but these errors were encountered: