collectiveidea / audited

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

Ignore callbacks if not specifed on the model #679

Closed JDrizzy closed 5 months ago

JDrizzy commented 11 months ago

Related comment/discussion: https://github.com/collectiveidea/audited/pull/662#issuecomment-1637265004

With the addition of touch auditing, I thought maybe a configuration could exclude certain callbacks unless the callback action was specified on the model.

Audited.ignored_default_callbacks = [:touch]

class User < ActiveRecord::Base
   audited
end
# audits on action :create, :update, :destroy

class Company < ActiveRecord::Base
  audited on: [:create, :touch]
end
# audits on action :create, :touch