Module: TrackChanges::Model::Base
- Defined in:
- lib/track_changes/model.rb
Instance Method Summary collapse
Instance Method Details
#tracks_changes(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/track_changes/model.rb', line 4 def tracks_changes( = {}) extend ClassMethods include InstanceMethods class_attribute :track_changes_options self. = attr_accessor :track_changes # Faux attribute to allow disabling of change tracking on this record attr_writer :track_changes_by # Faux attribute to store who made the changes so we can save it in the diff has_one :snapshot, :as => :record, :class_name => 'TrackChanges::Snapshot' # A representation of this record as it was last saved has_many :diffs, :as => :record, :class_name => 'TrackChanges::Diff' # A representation of changes made between saves through this record's lifetime after_save :persist_tracked_changes end |