Exception: CouchbaseOrm::Error::RecordInvalid

Inherits:
CouchbaseOrm::Error show all
Defined in:
lib/couchbase-orm/error.rb

Instance Attribute Summary

Attributes inherited from CouchbaseOrm::Error

#record

Instance Method Summary collapse

Constructor Details

#initialize(record = nil) ⇒ RecordInvalid

Returns a new instance of RecordInvalid.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/couchbase-orm/error.rb', line 14

def initialize(record = nil)
  if record
    @record = record
    errors = @record.errors.full_messages.join(', ')
    message = I18n.t(:"#{@record.class.i18n_scope}.errors.messages.record_invalid", errors: errors,
                                                                                    default: :"couchbase.errors.messages.record_invalid")
  else
    message = 'Record invalid'
  end
  super(message, record)
end