Class: Synapse::Command::ActiveModelValidationFilter
- Inherits:
-
CommandFilter
- Object
- CommandFilter
- Synapse::Command::ActiveModelValidationFilter
- Defined in:
- lib/synapse/command/filters/validation.rb
Instance Method Summary collapse
-
#filter(command) ⇒ CommandMessage
The command to dispatch on the bus.
Instance Method Details
#filter(command) ⇒ CommandMessage
Returns The command to dispatch on the bus.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/synapse/command/filters/validation.rb', line 7 def filter(command) payload = command.payload if payload.respond_to? :valid? unless payload.valid? raise ActiveModelValidationError, payload.errors end end command end |