Exception: NestedAttributeReassignable::RelationExists
- Inherits:
-
StandardError
- Object
- StandardError
- NestedAttributeReassignable::RelationExists
- Defined in:
- lib/nested_attribute_reassignable.rb
Instance Method Summary collapse
-
#initialize(model, relation) ⇒ RelationExists
constructor
A new instance of RelationExists.
- #message ⇒ Object
Constructor Details
#initialize(model, relation) ⇒ RelationExists
Returns a new instance of RelationExists.
6 7 8 9 |
# File 'lib/nested_attribute_reassignable.rb', line 6 def initialize(model, relation) @model = model.class.name.pluralize.underscore @relation = relation end |
Instance Method Details
#message ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/nested_attribute_reassignable.rb', line 11 def "Relation '\#{@relation}' already exists on '\#{@model}' object but attributes were passed with no id.\n\nIt is invalid to create a new '\#{@relation}' relation when one already exists, as it would leave orphaned records. Update the existing record instead.\n STR\nend\n" |