Module: BestBoy::Eventable

Extended by:
ActiveSupport::Concern
Defined in:
lib/best_boy/eventable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#trigger_best_boy_event(type, source = nil) ⇒ Object



29
30
31
# File 'lib/best_boy/eventable.rb', line 29

def trigger_best_boy_event type, source = nil
  create_best_boy_event_with_type(type, source)
end

#trigger_best_boy_event_report(klass: self.class.to_s, type: '', source: nil, date: Time.zone.now) ⇒ Object



33
34
35
36
# File 'lib/best_boy/eventable.rb', line 33

def trigger_best_boy_event_report(klass: self.class.to_s, type: '', source: nil, date: Time.zone.now)
  BestBoy::MonthReport.current_or_create_for(klass, type, source, date).increment!(:occurrences)
  BestBoy::DayReport.current_or_create_for(klass, type, source, date).increment!(:occurrences)
end