You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See tests defined here, noting that only the second one fails: jordannb@78c2e8d
For convenience, here is the failing test:
it "does save non-empty values when using assoc name" do
e = TestClass.create!
e.name = "TEST"
e.no_empties_assoc.ext_field_using_empties_not_saved = "Another test"
e.save!
expect(NoEmptiesAssociationTestClass.count).to eq(1)
end
This fails because the empty record returned by no_empties_assoc is merely an in-memory placeholder and isn't actually associated (in ActiveRecord terms) with the parent record, e, that it "belongs" to. Data set this way will work if the :no_empties_assoc returns a non-empty value (on that is stored in the database), as this means there's an association with the parent record.
Due to the custom setters created by the ExternalFields gem, we don't actually need to set values using this mechanism at all, and the fact that it works is an undocumented behavior (note that README and existing tests suggest that e.ext_field_using_empties_not_saved = "Another test" is the way to set values, note.no_empties_assoc.ext_field_using_empties_not_saved = "Another test". The second mechanism is redundant, undocumented, and perhaps unnecessary.
I propose we either update the behavior so that it's consistent or remove the ability to set values in this way entirely. It'd be good to consider addressing this before #29 .
The text was updated successfully, but these errors were encountered:
See tests defined here, noting that only the second one fails: jordannb@78c2e8d
For convenience, here is the failing test:
This fails because the empty record returned by
no_empties_assoc
is merely an in-memory placeholder and isn't actually associated (in ActiveRecord terms) with the parent record,e
, that it "belongs" to. Data set this way will work if the:no_empties_assoc
returns a non-empty value (on that is stored in the database), as this means there's an association with the parent record.Due to the custom setters created by the ExternalFields gem, we don't actually need to set values using this mechanism at all, and the fact that it works is an undocumented behavior (note that README and existing tests suggest that
e.ext_field_using_empties_not_saved = "Another test"
is the way to set values, note.no_empties_assoc.ext_field_using_empties_not_saved = "Another test"
. The second mechanism is redundant, undocumented, and perhaps unnecessary.I propose we either update the behavior so that it's consistent or remove the ability to set values in this way entirely. It'd be good to consider addressing this before #29 .
The text was updated successfully, but these errors were encountered: