Exception: Relaxo::Model::ValidationErrors

Inherits:
StandardError
  • Object
show all
Defined in:
lib/relaxo/model/document.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ValidationErrors

Returns a new instance of ValidationErrors.



30
31
32
33
34
# File 'lib/relaxo/model/document.rb', line 30

def initialize(errors)
	super "Model validation errors occurred: #{self.class.message_for_errors(errors)}"
	
	@errors = errors
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



36
37
38
# File 'lib/relaxo/model/document.rb', line 36

def errors
  @errors
end

Class Method Details

.message_for_errors(errors) ⇒ Object



26
27
28
# File 'lib/relaxo/model/document.rb', line 26

def self.message_for_errors(errors)
	errors.map{|error| "#{error.key} (#{error.exception.message})"}.join(', ')
end