hi. i'm sorry to bother you all, but this time i'm really clueles.
seems like i can't load association. the whole thing takes place
between class Operator and class Day, which are linked by a many-2-
many association. see this irb session (this is long, i know, please
be patient):

get some records:

>> operator = Operator.get(1)
=> #<Operator id=1 name="Alberto">
>> day1 = Day.get(1)
=> #<Day id=1 date=#<Date: 4909905/2,0,2299161>>
>> day2 = Day.get(2)
=> #<Day id=2 date=#<Date: 4909907/2,0,2299161>>

now, 'dispos' is association name in class Operator, to which i append
Days:

>> operator.dispos << day1
=> [#<Day id=1 date=#<Date: 4909905/2,0,2299161>>]
>> operator.dispos << day2
=> [#<Day id=1 date=#<Date: 4909905/2,0,2299161>>, #<Day id=2
date=#<Date: 4909907/2,0,2299161>>]

save everything, right?

>> [operator, day1, day2].each {|e| e.save}
=> [#<Operator id=1 name="Alberto">, #<Day id=1 date=#<Date:
4909905/2,0,2299161>>, #<Day id=2 date=#<Date: 4909907/2,0,2299161>>]

now read dispos from operator: all goes fine...

>> operator.dispos
=> [#<Day id=1 date=#<Date: 4909905/2,0,2299161>>, #<Day id=2
date=#<Date: 4909907/2,0,2299161>>]

...BUT! if i reload the very same operator, the association is gone
(well, part...): i get just the first day!

>> the_same_operator = Operator.get(1)
=> #<Operator id=1 name="Alberto">
>> the_same_operator.dispos
=> [#<Day id=1 date=#<Date: 4909905/2,0,2299161>>]

needless to say, if i quit irb and then respawn:

>> Operator.get(1).dispos
=> [#<Day id=1 date=#<Date: 4909905/2,0,2299161>>]

what's wrong? am i missing something obvious?

thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to