Exception: Rails::DataMapper::MultiparameterAssignmentErrors

Inherits:
StandardError
  • Object
show all
Defined in:
lib/dm-rails/multiparameter_attributes.rb

Overview

Raised by Rails::DataMapper::MultiparameterAttributes#attributes= when there are errors when merging multiparameter attributes. Use #errors to get the array of errors occured.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors, message = nil) ⇒ MultiparameterAssignmentErrors

Initializes a new instance of the Rails::DataMapper::MultiparameterAssignmentErrors class.

Parameters:

  • errors (Array<MultiparameterAssignmentError>)

    The array of assignment errors.

  • message (String) (defaults to: nil)

    Optional error message.



45
46
47
48
# File 'lib/dm-rails/multiparameter_attributes.rb', line 45

def initialize(errors, message = nil)
  super(message || "#{errors.size} error#{errors.size == 1 ? '' : 's'} on assignment of multiparameter attributes.")
  @errors = errors
end

Instance Attribute Details

#errorsArray<MultiparameterAssignmentError> (readonly)

Gets the array of assignment errors.

Returns:



38
39
40
# File 'lib/dm-rails/multiparameter_attributes.rb', line 38

def errors
  @errors
end