Just a small bug report: I can't get upsert! to work on associations, like so:
class Parent; ... end
class MyModel
include BaseModel
belongs_to :parent
field :username, String
field :data, String, unique: { scope: [:parent_id, :username] }
end
MyModel.upsert! parent: @parent, username: "me", data: "test"
It fails on not finding a matching uniqueness validator (because it's looking for :parent_id instead of :parent). As a consequence, if I do
Just a small bug report: I can't get upsert! to work on associations, like so:
It fails on not finding a matching uniqueness validator (because it's looking for :parent_id instead of :parent). As a consequence, if I do
it works as expected.
(Note that I had to set the uniq validator on :data to look for :parent_id, too, instead of :shard.)