Module: Eventsimple::Event
- Includes:
- GlobalID::Identification
- Defined in:
- lib/eventsimple/event.rb
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Instance Method Summary collapse
-
#drives_events_for(aggregate_klass, aggregate_id:, events_namespace: nil) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength.
Instance Method Details
#drives_events_for(aggregate_klass, aggregate_id:, events_namespace: nil) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/eventsimple/event.rb', line 7 def drives_events_for(aggregate_klass, aggregate_id:, events_namespace: nil) class_attribute :_events_namespace self._events_namespace = events_namespace class_attribute :_aggregate_klass self._aggregate_klass = aggregate_klass class_attribute :_aggregate_id self._aggregate_id = aggregate_id class_attribute :_outbox_enabled class_attribute :_on_invalid_transition self._on_invalid_transition = ->(error) { raise error } self.inheritance_column = :type self.store_full_sti_class = false attribute :metadata, MetadataType.new attr_writer :skip_dispatcher attr_writer :skip_apply_check belongs_to _aggregate_klass.model_name.element.to_sym, foreign_key: :aggregate_id, primary_key: _aggregate_id, class_name: _aggregate_klass.name.to_s, inverse_of: :events, autosave: false, validate: false default_scope { order('created_at ASC') } before_validation :extend_validation after_validation :perform_transition_checks before_create :apply_and_persist after_create :dispatch include InstanceMethods extend ClassMethods end |