Exception: DuckRecord::RecordInvalid
- Inherits:
-
DuckRecordError
- Object
- StandardError
- DuckRecordError
- DuckRecord::RecordInvalid
- Defined in:
- lib/duck_record/validations.rb
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(record = nil) ⇒ RecordInvalid
constructor
A new instance of RecordInvalid.
Constructor Details
#initialize(record = nil) ⇒ RecordInvalid
Returns a new instance of RecordInvalid.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/duck_record/validations.rb', line 8 def initialize(record = nil) if record @record = record errors = @record.errors..join(", ") = I18n.t(:"#{@record.class.i18n_scope}.errors.messages.record_invalid", errors: errors, default: :"errors.messages.record_invalid") else = "Record invalid" end super() end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
6 7 8 |
# File 'lib/duck_record/validations.rb', line 6 def record @record end |