class Aggregates::Command
Commands are a type of message that define the shape and contract data that is accepted for an attempt at performing a state change on a given aggregate. Essentially, they provide the api for interacting with your domain. Commands should have descriptive names capturing the change they are intended to make to the domain. For instance, `ChangeUserEmail` or `AddComment`. :reek: MissingSafeMethod { exclude: [ validate! ] }
Attributes
aggregate_type[R]
Public Class Methods
interacts_with(aggregate_type)
click to toggle source
# File lib/aggregates/command.rb, line 15 def interacts_with(aggregate_type) @aggregate_type = aggregate_type end
Public Instance Methods
validate!()
click to toggle source
Calls superclass method
# File lib/aggregates/command.rb, line 20 def validate! super rescue ActiveModel::ValidationError raise Aggregates::CommandValidationError, errors.as_json end