Search code examples
ruby-on-railsrubyrubygemsacts-as-audited

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?


Solution

  • 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