#1392 ✓resolved
dominic

local view objects don't update when creating joining resources.

Reported by dominic | August 22nd, 2010 @ 02:43 AM | in 1.1

say i have two model objects with a many to many relationship,
given two instances of those:

t = Thing.create
w = Whatever.create

#creating a joining resource:

ThingWhatever.create(:thing => t, :whatever => w)

[t] == w.things #true
[w] == t.whatevers #true

#then create a second join resource from t to a new Whatever

ThingWhatever.create(:thing => t, :whatever => (w2 = Whatever.create))

[w,w2] == t.whatevers #false

#I'm new to DataMapper so this was very confusing.
#eventually i discovered I could work around the problem with:

t2.reload
[w,w2] == t.whatevers #true

however, reload is not mentioned in the getting started documentation and it took me hours to figure out why it wasn't working.

at least, mention reload in the getting started documentation... it could save people like me many hours in that period where they are deciding whether or not to use DataMapper.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Attachments

Referenced by

Pages