Exception: MuchRails::Records::DestructionInvalid
- Inherits:
-
StandardError
- Object
- StandardError
- MuchRails::Records::DestructionInvalid
- Defined in:
- lib/much-rails/records/validate_destroy.rb
Instance Attribute Summary collapse
-
#error_full_messages ⇒ Object
readonly
Returns the value of attribute error_full_messages.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(record = nil, field_name: :base) ⇒ DestructionInvalid
constructor
A new instance of DestructionInvalid.
Constructor Details
#initialize(record = nil, field_name: :base) ⇒ DestructionInvalid
Returns a new instance of DestructionInvalid.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/much-rails/records/validate_destroy.rb', line 70 def initialize(record = nil, field_name: :base) super(record&..to_a.join("\n")) @record = record = record&..to_a @errors = if .any? { field_name.to_sym => } else {} end @error_full_messages = if field_name == :base else .map do |m| ActiveModel::Error.new(@record, field_name, m). end end end |
Instance Attribute Details
#error_full_messages ⇒ Object (readonly)
Returns the value of attribute error_full_messages.
68 69 70 |
# File 'lib/much-rails/records/validate_destroy.rb', line 68 def @error_full_messages end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
68 69 70 |
# File 'lib/much-rails/records/validate_destroy.rb', line 68 def errors @errors end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
68 69 70 |
# File 'lib/much-rails/records/validate_destroy.rb', line 68 def record @record end |