Exception: RESTFramework::Errors::BulkRecordErrorsError
- Inherits:
-
BaseError
- Object
- StandardError
- BaseError
- RESTFramework::Errors::BulkRecordErrorsError
- Defined in:
- lib/rest_framework/errors.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(records) ⇒ BulkRecordErrorsError
constructor
A new instance of BulkRecordErrorsError.
- #message ⇒ Object
-
#record ⇒ Object
Allow
e.try(:record).try(:errors)to chain through the standard error handler.
Constructor Details
#initialize(records) ⇒ BulkRecordErrorsError
Returns a new instance of BulkRecordErrorsError.
48 49 50 51 52 53 |
# File 'lib/rest_framework/errors.rb', line 48 def initialize(records) @errors = records.each_with_index.filter_map { |record, i| next unless record.errors.any? { index: i, errors: record.errors. } } end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
46 47 48 |
# File 'lib/rest_framework/errors.rb', line 46 def errors @errors end |
Instance Method Details
#message ⇒ Object
60 61 62 63 64 |
# File 'lib/rest_framework/errors.rb', line 60 def "Bulk operation failed due to validation errors on #{@errors.length} #{ 'record'.pluralize(@errors.length) }." end |
#record ⇒ Object
Allow e.try(:record).try(:errors) to chain through the standard error handler.
56 57 58 |
# File 'lib/rest_framework/errors.rb', line 56 def record self end |