I have a User class,  a Membership class and a join model
UserMembership. Membership has an attribute called :year.

I observe that for a User object 'u', I can do this -

u.user_memberships.first('membership.year' => '2009')

but this -

u.user_memberships.all('membership.year' => '2009')

throws an exception -

ArgumentError: Unknown property 'name'
        from /home/mark/Code/merb/craw/gems/gems/dm-core-0.9.11/lib/dm-core/
query.rb:667:in `method_missing'
etc...

Any ideas why this would be? I can get around it by using 'find' with
a block, but it's a bit more complicated.

BTW I haven't actually  seen the usage in the first case documented
anywhere, but I was experimenting based on an example on the wiki that
does a find like this -

Article.all('author.name' => 'Michael')

Is this approach meant to work on collections as well as models?
--~--~---------~--~----~------------~-------~--~----~
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