And incidentally, the query 'works' in the sense that it returns a
value without raising an exception, but it just grabs the wrong
record. OTOH

Role.first(:name=>'Secretary').users.first

works just fine, but it doesn't seem as elegant.


On Feb 15, 3:18 pm, MarkMT <[email protected]> wrote:
> No I'm on mysql.
>
> On Feb 15, 2:50 pm, Woongcheol Yang <[email protected]> wrote:
>
> > Hi,
>
> > I asked a similar question before, and the answer was such queries do not
> > work with sqlite3. Are you using sqlite3?
>
> > wy
>
> > On Mon, Feb 15, 2010 at 3:39 PM, MarkMT <[email protected]> wrote:
> > > Hi -
>
> > > Given the following models,
>
> > > class User
> > >  include DataMapper::Resource
> > >  property :id, Serial
> > >  property :name, String
> > >  has n, :roles, :through => Resource
> > > end
>
> > > class Role
> > >  include DataMapper::Resource
> > >  property :id, Serial
> > >  property :name, String
> > >  has n, :users, :through => Resource
> > > end
>
> > > my understanding was that I could do something like this -
>
> > > User.first(:roles=>{:name =>'Secretary'})
>
> > > and get the person whose role is Secretary. Unfortunately I'm getting
> > > the wrong people, consistently for a number of different cases. Is
> > > there some reason why this should not be expected to work?
>
> > > --
> > > 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]<datamapper%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/datamapper?hl=en.

-- 
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