Module: ActsAsTracked::Tracking
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/acts_as_tracked/tracking.rb
Instance Method Summary collapse
- #activities ⇒ Object
- #activity_attributes ⇒ Object
- #activity_label ⇒ Object
- #tracking_changes(attributes) ⇒ Object
- #tracking_changes? ⇒ Boolean
Instance Method Details
#activities ⇒ Object
23 24 25 26 27 |
# File 'lib/acts_as_tracked/tracking.rb', line 23 def activities t = Activity.arel_table Activity.where t[:subject_type].eq(self.class.name).and(t[:subject_id].eq(id)) .or(t[:parent_type].eq(self.class.name).and(t[:parent_id].eq(id))) end |
#activity_attributes ⇒ Object
42 43 44 |
# File 'lib/acts_as_tracked/tracking.rb', line 42 def activity_attributes self.class.__global_activity_attributes.merge(@activity_attributes || {}) end |
#activity_label ⇒ Object
46 47 48 |
# File 'lib/acts_as_tracked/tracking.rb', line 46 def activity_label raise NotImplementedError, "You must define this method in #{self.class}" end |
#tracking_changes(attributes) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/acts_as_tracked/tracking.rb', line 29 def tracking_changes(attributes) @activity_attributes = attributes @tracking_changes = true yield ensure @activity_attributes = {} @tracking_changes = false end |
#tracking_changes? ⇒ Boolean
38 39 40 |
# File 'lib/acts_as_tracked/tracking.rb', line 38 def tracking_changes? @tracking_changes || self.class.__global_tracking_changes end |