Module: Mongoid::Tracking::ClassMethods
- Defined in:
- lib/mongoid/tracking.rb
Instance Method Summary collapse
-
#track(name) ⇒ Object
Adds analytics tracking for
name
.
Instance Method Details
#track(name) ⇒ Object
Adds analytics tracking for name
. Adds a ‘name’_data mongoid field as a Hash for tracking this information. Additionaly, hiddes the field, so that the user can not mangle with the original one. This is necessary so that Mongoid does not “dirty” the field potentially overwriting the original data.
29 30 31 32 33 |
# File 'lib/mongoid/tracking.rb', line 29 def track(name) set_tracking_field(name.to_sym) create_tracking_accessors(name.to_sym) update_aggregates(name.to_sym) if aggregated? end |