It is not possible to overwrite an association with nil.
class Units < ROM::Relation[:sql]
schema(:units, infer: true) do
associations do
has_many :users
end
end
end
class Users < ROM::Relation[:sql]
schema(:users, infer: true) do
associations do
belongs_to :unit
end
end
end
Factory.define(:user) do |f|
f.id { fake(:number, :number, digits: 3) }
f.name { fake(:name, :name) }
f.association(:unit)
end
Following overwrite of the association unit fails:
Describe the bug
It is not possible to overwrite an association with nil.
Following overwrite of the association
unit
fails:Expected behavior
the expected behavior should be a resulting user-db-entry holding a
unit_id
ofNULL
and the returned ruby-object should be look like this:Workaround
WDYT? How should we fix this? Thanks and best regards