
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
-
Martin Gamsjaeger (snusnu) October 29th, 2010 @ 03:59 PM
- State changed from new to confirmed
- Milestone set to 1.1
- Assigned user set to Martin Gamsjaeger (snusnu)
- Milestone order changed from 196263 to 0
Agreed, I will add a patch to datamapper.org soon.
-
-
Dan Kubb (dkubb) January 22nd, 2011 @ 02:11 PM
- State changed from confirmed to resolved
(from [bf5b4fb6b67314c3b47b84e8c440901c9ad3930f]) Explain when to use #reload on models or relationships
[#1392 state:resolved] https://github.com/datamapper/datamapper.github.com/commit/bf5b4fb6...
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Attachments
Tags
Referenced by
-
1392 local view objects don't update when creating joining resources. [#1392 state:resolved] https://github.com/datamapper/dat...