Open splurgy-michi opened 12 years ago
I know this is a couple months old, but I did this in a model:
Audit = Audited::Adapters::ActiveRecord::Audit
class Audit
# my custom methods
end
That way, I can access it with Audit.whatever, AND I can add my own custom methods. Works well. You could probably use class inheritance as well, but I haven't tried it:
class Audit < Audited::Adapters::ActiveRecord::Audit
# whatevers
end
@dougc84 :+1: Exactly something I want to do, but doesn't seem to work if I use associated_audits
. I get an undefined method error for Audited::Adapters::ActiveRecord::Audit
instead of it actually using me Audit
class
@tomprats you could always write a class and have it extend Audited::Adapters::ActiveRecord::Audit from an initializer
@dougc84 How do I have associated_audits
to use that extended class then? Right now I'm just trying to add methods to the library's Audited::Adapters::ActiveRecord::Audit
class but I'm not sure exactly how to do that. I've added my audit.rb
file to the lib directory, configured the application.rb
to autoload it, but I haven't been able to add anything to the Audit
class (even trying to nest it in it's modules)
Wow, I actually got it to work successfully, what took me so long was something with postgres being setup incorrectly.
Is there a simple way to get audit entries by user? As in the value in the user_id column?
The current "hack" looks like this:
Is this the only way?