We have for example a field owner in Item, but at the same time a field items in User, which describes the same thing. This makes it hard to extend code and one has to update two bindings after editing an item.
We should probably remove one binding (i would remove items in User), but instead create a function in User:
def items
Item.get_all.select(|item| item.owner == self)
end
With this, all we have to do when updating the ownership is change the owner of the item.
We have for example a field
owner
in Item, but at the same time a fielditems
in User, which describes the same thing. This makes it hard to extend code and one has to update two bindings after editing an item. We should probably remove one binding (i would removeitems
in User), but instead create a function in User:With this, all we have to do when updating the ownership is change the
owner
of the item.