Class: ActiveDomain::EventRepository

Inherits:
Object
  • Object
show all
Defined in:
app/models/active_domain/event_repository.rb

Class Method Summary collapse

Class Method Details

.after_id(id) ⇒ Object



8
9
10
# File 'app/models/active_domain/event_repository.rb', line 8

def self.after_id(id)
  ordered.where ActiveDomain::Event.arel_table['id'].gt(id)
end

.orderedObject



4
5
6
# File 'app/models/active_domain/event_repository.rb', line 4

def self.ordered
  ActiveDomain::Event.order(:id)
end

.store(event) ⇒ Object



12
13
14
15
# File 'app/models/active_domain/event_repository.rb', line 12

def self.store(event)
  stored_event = ActiveDomain::Event.create!(event: event.class.name, data: event.to_hash)
  event.add_store_infos id: stored_event.id, created_at: stored_event.created_at
end