Module: ActsAsFootprintable::Footprinter
- Defined in:
- lib/acts_as_footprintable/footprinter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #access_histories(limit = nil) ⇒ Object
- #access_histories_for(klass, limit = nil) ⇒ Object
- #leave_footprints(footprintable) ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/acts_as_footprintable/footprinter.rb', line 5 def self.included(base) base.class_eval do has_many :footprints, class_name: 'ActsAsFootprintable::Footprint', as: :footprinter, dependent: :destroy do def footprintable includes(:footprintable).map(&:footprintable) end end end end |
Instance Method Details
#access_histories(limit = nil) ⇒ Object
24 25 26 |
# File 'lib/acts_as_footprintable/footprinter.rb', line 24 def access_histories(limit = nil) get_access_history_records(footprints, limit) end |
#access_histories_for(klass, limit = nil) ⇒ Object
20 21 22 |
# File 'lib/acts_as_footprintable/footprinter.rb', line 20 def access_histories_for(klass, limit = nil) get_access_history_records(footprints.for_type(klass), limit) end |
#leave_footprints(footprintable) ⇒ Object
15 16 17 18 |
# File 'lib/acts_as_footprintable/footprinter.rb', line 15 def leave_footprints(footprintable) footprint = ActsAsFootprintable::Footprint.new(footprintable: footprintable, footprinter: self) footprint.save end |