ese-unibe-ch / ese2012-team4

5 stars 1 forks source link

remove two-way associations #64

Closed LukasSkywalker closed 11 years ago

LukasSkywalker commented 11 years ago

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.