Sha256: 325a051419e2add14bcadc230063287f502cbb1d85a1381da10a5d6f6dcfe944
Contents?: true
Size: 452 Bytes
Versions: 5
Compression:
Stored size: 452 Bytes
Contents
module OhMyLog class ActiveRecordObserver < ::ActiveRecord::Observer #this is the callback that happens every time after we made changes to the model def after_save(model) #we only add this model in the target list if this model got SUCCESSFULLY change must_be_logged = model.methods.include?(:saved_changes) ? model.saved_changes.empty? : model.changes.empty? Log::add_target(model) unless must_be_logged end end end
Version data entries
5 entries across 5 versions & 1 rubygems