Module: ActsAsAppstatsable::InstanceMethods

Defined in:
lib/appstats/acts_as_appstatsable.rb

Instance Method Summary collapse

Instance Method Details

#track(action, contexts) ⇒ Object



58
59
60
61
62
63
64
65
66
# File 'lib/appstats/acts_as_appstatsable.rb', line 58

def track(action,contexts)
  begin
    Appstats::Logger.entry(action,contexts)
    true
  rescue Exception => e
    Appstats::Logger.exception_entry(e,:on => action)
    false
  end
end

#track_createObject



43
44
45
46
# File 'lib/appstats/acts_as_appstatsable.rb', line 43

def track_create
  return false unless self.appstats_after_create
  track('object-created', :class_name => self.class.name, :class_id => self.id, :details => self.to_s)
end

#track_destroyObject



48
49
50
51
# File 'lib/appstats/acts_as_appstatsable.rb', line 48

def track_destroy
  return false unless self.appstats_after_destroy
  track('object-destroyed', :class_name => self.class.name, :class_id => self.id, :details => self.to_s)
end

#track_updateObject



53
54
55
56
# File 'lib/appstats/acts_as_appstatsable.rb', line 53

def track_update
  return false unless self.appstats_after_update
  track('object-updated', :class_name => self.class.name, :class_id => self.id, :details => self.to_s)
end