Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

audited, Look up audits belonging to a user

I am using audited to track changes for a model called Page. I would like to be able to find all audits associated with a certain user (via user_id in the audits table).

How can I do that? So far, the only way I have found to access the Audit model is like this:

@audits = Audited::Adapters::ActiveRecord::Audit.all

Which just doesn't seem like it's the right way to do things.

Trying @audits = Audit.all gives an Uninitialized constant error.

Is there a more graceful way of interacting with models provided by gems?

like image 727
Jay Avatar asked Jul 08 '12 13:07

Jay


1 Answers

Maybe something like

include Audited::Adapters::ActiveRecord::Audit

and then you can do

@audits = Audit.all

?

I think that should work... Or better yet:

include Audited

like image 144
varatis Avatar answered Sep 28 '22 06:09

varatis