The expression Foo.all(:limit=>2).count

produces the query

SELECT COUNT(*) FROM `foos` LIMIT 2

which is incorrect, as the precedence of LIMIT applies to the one row
returned by count.

This is a big deal with many pagination plugins.

(Also, I'd post this in lighthouse if I could figure out how to get
sqlite3 adapter to work w/ 1.0...
I tried DataMapper.setup(:default, 'sqlite3::memory:'
but that complained that it couldn't find the adapter..  am i missing a require?

I also remember someone posting a bug template somewhere a few days
ago, but I cannot seem to find it.)



#!/usr/bin/env ruby

require 'rubygems'
gem 'dm-core', '~>1.0.0'
require 'dm-core'
require 'dm-aggregates'
require 'dm-do-adapter'
require 'data_objects'
require 'dm-migrations'

DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'mysql://r...@localhost/ts')

class Foo
  include DataMapper::Resource
  property :id, Serial
end

DataMapper.auto_migrate!

Foo.create
Foo.create
Foo.create
puts Foo.all(:limit=>2).count   # prints 3
puts Foo.all(:limit=>2).to_a.size   # prints 2

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