class Sequent::Core::CommandRecord
For storing Sequent::Core::Command
in the database using active_record
Public Instance Methods
Source
# File lib/sequent/core/command_record.rb, line 66 def origin_command parent_event&.parent_command&.origin_command || self end
Also aliased as: origin
Source
# File lib/sequent/core/command_record.rb, line 60 def parent_event return nil unless event_aggregate_id && event_sequence_number @parent_event ||= EventRecord.find_by(aggregate_id: event_aggregate_id, sequence_number: event_sequence_number) end
A ‘belongs_to` association fails in weird ways with ActiveRecord 7.1, probably due to the use of composite primary keys so use an explicit query here and cache the result.
Also aliased as: parent