Hello all,
I just started learning DataMapper and I'm stuck at what I think should be
pretty simple.
My models look like this:
class Post
include DataMapper::Resource
has n, :labels, :through => Resource
end
class Label
include DataMapper::Resource
property :name, String
has n, :posts, :through => Resource
end
they both have some extra properties which I omitted. Other than that they
exactly follow the examples given in DataMapper associations documentation.
When I query like this:
Post.all( :labels => { :name => 'orange' } )
I want to get all posts that has a label named orange. What it is giving me
instead is a post whose id is same as the id of the label named orange. More
confusingly, when I query:
Post.all( :labels => Label.get(4) )
I get what I would get with Post.get(4). I double-checked that the post with
id 4 is not associated with the label with id 4 in the database.
I would really appreciate if someone could teach me what I'm doing wrong
here.
I'm using dm-core 0.10.2 with sqlite3.
wy
--
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.