Exception: MassiveRecord::ORM::RecordInvalid

Inherits:
MassiveRecordError show all
Defined in:
lib/massive_record/orm/validations.rb

Overview

Raised when save! or create! fails due to invalid record A rescued error contains record which you can read errors from as normal

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ RecordInvalid

Returns a new instance of RecordInvalid.



11
12
13
14
15
# File 'lib/massive_record/orm/validations.rb', line 11

def initialize(record)
  @record = record
  errors = @record.errors.full_messages.join(", ")
  super(I18n.t("activemodel.errors.messages.record_invalid", :errors => errors))
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record.



10
11
12
# File 'lib/massive_record/orm/validations.rb', line 10

def record
  @record
end