Module: Lyra::Associations::EventAware
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/lyra/associations/event_aware.rb
Overview
Event-aware association module for handling eventual consistency.
In event_sourcing mode, associated records may not exist in the database yet if projections are async. This module provides event-aware versions of Rails associations that fall back to event reconstruction when needed.
Usage in models:
class Registration < ApplicationRecord
include Lyra::Associations::EventAware
event_aware_belongs_to :program
event_aware_has_many :payment_transactions
end