collectiveidea / audited

Audited (formerly acts_as_audited) is an ORM extension that logs all changes to your Rails models.
MIT License
3.39k stars 688 forks source link

Custom callbacks #135

Open nchatu opened 11 years ago

nchatu commented 11 years ago

Is there a way to add custom callbacks to a audited model? For example completing a task. Currently I add a flag to comments column to identify custom action but it doesn't feel as a clean way to do it.

davidchua commented 11 years ago

On a slightly related note, I noticed that there's an after_audit callback which was not documented in the README. Is there a reason why?

Was curious because I had to stumbleupon the existence of that callback and it may save other people some time if it was documented.

jasonperrone commented 8 years ago

Have you actually gotten that callback to work?

jasonperrone commented 8 years ago

I could not get that to work, so instead I created an observer like so:

class AuditObserver < ActiveRecord::Observer
  observe Audited::Adapters::ActiveRecord::Audit
  def before_create(audit)
      puts 'sup?'
  end
end
DannyBen commented 6 years ago

So.... no callback support as of yet?

vzelenko commented 4 years ago

Would it not make sense to use Custom Audit Model for this use case? https://github.com/collectiveidea/audited#custom-audit-model

Gaurav3khede commented 4 years ago

Would it not make sense to use Custom Audit Model for this use case? https://github.com/collectiveidea/audited#custom-audit-model

Hi, can you please share any examples of this. Thanks :) There not much information in README.