acts_as_audited and ActiveScaffold
Several people have reported that acts_as_audited does not work with ActiveScaffold. I don’t use ActiveScaffold, so I had no motivation to fix it. But thanks to a tip from Aaron, this has now been fixed.
To make acts_as_audited work with ActiveScaffold, only enable auditing for only the :create
, :update
, and :destroy
actions.
class ApplicationController < ActionController::Base
audit User, Thing, :only => [:create, :update, :destroy]
end
I’m not sure exactly why it breaks or why this fixes it, but from this thread it sounds like ActiveScaffold just doesn’t support polymorphic associations, which is what acts_as_audited uses to associated audits with models.