Module: MongoidActivityTracker::Tracker

Defined in:
lib/mongoid_activity_tracker/tracker.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actor_cache_methodsObject

Returns the value of attribute actor_cache_methods


6
7
8
# File 'lib/mongoid_activity_tracker/tracker.rb', line 6

def actor_cache_methods
  @actor_cache_methods
end

Class Method Details

.included(base) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/mongoid_activity_tracker/tracker.rb', line 45

def self.included(base)
  base.extend ClassMethods
  base.class_eval do
    include Mongoid::Document

    field :action, type: Symbol

    tracks :actor

    validates :actor, presence: true
    validates :action, presence: true
  end
end

Instance Method Details

#created_atObject


61
62
63
# File 'lib/mongoid_activity_tracker/tracker.rb', line 61

def created_at
  id.generation_time.in_time_zone(Time.zone)
end