Exception: WellFormed::RecordInvalid

Inherits:
Error
  • Object
show all
Defined in:
lib/well_formed/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ RecordInvalid

Returns a new instance of RecordInvalid.



10
11
12
13
14
# File 'lib/well_formed/errors.rb', line 10

def initialize(record)
  @record = record
  messages = record.errors.full_messages
  super(messages.empty? ? "Record invalid" : "Validation failed: #{messages.join(", ")}")
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record.



8
9
10
# File 'lib/well_formed/errors.rb', line 8

def record
  @record
end