All pastes #374821 Raw Edit

Untitled

public text v1 · immutable
#374821 ·published 2007-02-27 21:01 UTC
rendered paste body
cont = Container.find(1)
thing = Thingy.find(cont.thingies[0].id)
# assume a has_many relation and that the db has these objects already
thing.some_attr = new_val
cont.thingies = [thing]
cont.save
cont.thingies[0].id == thing.id  #=> true
cont.thingies[0].some_attr == thing.some_attr  #=> false!!!