Exception: Stretchy::Errors::ValidationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/stretchy/errors/validation_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ValidationError

Returns a new instance of ValidationError.



5
6
7
# File 'lib/stretchy/errors/validation_error.rb', line 5

def initialize(errors)
  @errors = errors
end

Instance Method Details

#messageObject



9
10
11
12
13
# File 'lib/stretchy/errors/validation_error.rb', line 9

def message
  @errors.map do |key, err|
    "Attribute #{key} violated rule #{err[:rule]}"
  end.join("\n")
end