So I'm trying to get the nth result from the database:

a = Task.all(:limit => 10, :order => [ :ordering.asc ]).last

but this query, instead of returning the 10th item actually returns
the last item in the database.  I get the same results if I do this:

a = Task.all(:limit => 10, :order => [ :ordering.asc ])
a = a.last

However, I get the results I want if I do something like this:


a = Task.all(:limit => 10, :order => [ :ordering.asc ])
a.each do |task|
  # do nothing
end
a = a.last

I gather this is the result of some query optimization going on, but
this is a bug, right?  So for the time being, is there are better way
of forcing the query to take place before '.last' and/or is there a
more efficient way for me to get the 10th record with the above
condition?

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