I've just spent all day trying to get started with DataMapper
I've found a few gotchas:
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.
eventaully i discovered I could work around the problem with:
[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.
It's a bit of a leaky abstraction. you can see the database through the cracks.
posted a ticket
I considered trying ActiveRecord but it smelled even leakier.