Sha256: 5ae05c50ebb911df09bd2b50ecbb7205cdb36044f8ee0e0c7f819aabdee9c200
Contents?: true
Size: 646 Bytes
Versions: 2
Compression:
Stored size: 646 Bytes
Contents
module TrackChanges module ActiveRecord # Enables auditing of all changes to an ActiveRecord model. Sets up an # around filter that will create an Audit for the models <tt>changes</tt> # attribute. # # In addition, this will also define a <tt>attr_accessor</tt> for <tt>current_user</tt>. def track_changes send :include, TrackChanges::CurrentUser send :include, TrackChanges::Changes self.class_eval do has_many :audits, :as => :audited around_update TrackChanges::AroundUpdate end end end end ActiveRecord::Base.extend TrackChanges::ActiveRecord
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
track_changes-1.0.1 | lib/track_changes/active_record.rb |
track_changes-1.0.0 | lib/track_changes/active_record.rb |