Class: ApplicationEvent

Inherits:
RailsEventStore::Event
  • Object
show all
Defined in:
app/events/application_event.rb

Overview

Base class for all domain events in this application.

JSON serialization (used by RailsEventStore::JSONClient) converts symbol keys
to strings on round-trip: { party_id: 1 } → stored as "party_id":1 → loaded
as { "party_id" => 1 }. Handlers throughout the app access data with symbol
keys (event.data[:party_id]), so we wrap the deserialized hash in
HashWithIndifferentAccess so both forms always work.

See: https://railseventstore.org/docs/advanced-topics/event-serialization-formats

Instance Method Summary collapse

Instance Method Details

#dataObject



13
14
15
# File 'app/events/application_event.rb', line 13

def data
  ActiveSupport::HashWithIndifferentAccess.new(super)
end