Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

aggegrates don't work in Ruby 2.0 #20

Open
strallhofer opened this issue Apr 10, 2013 · 2 comments
Open

aggegrates don't work in Ruby 2.0 #20

strallhofer opened this issue Apr 10, 2013 · 2 comments

Comments

@strallhofer
Copy link

require 'data_mapper'
require 'dm-migrations'
require 'dm-aggregates'

class DmNilTest
include DataMapper::Resource
property :id, Serial
property :test_value, Float
end

DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'postgres://elmar@localhost/dm_nil')

DataMapper.auto_upgrade!
DataMapper.finalize

DmNilTest.all.destroy
10.times do
DmNilTest.create(test_value: rand)
end

puts DmNilTest.aggregate(:test_value.min, :test_value.max, :test_value.avg).inspect

SQL statement is the same both in Ruby 1.9.3 and 2.0.0:
SELECT MIN("test_value"), MAX("test_value"), AVG("test_value") FROM "dm_nil_tests"

but in the latter case the result is [nil, nil, nil]

@dkubb
Copy link
Member

dkubb commented Apr 12, 2013

@strallhofer Try using the latest release-1.2 branches for dm-core, dm-aggregates and any other DM gems you use.

I believe this is a typecasting issue which was recently fixed. If the problem persists please let me know.

@strallhofer
Copy link
Author

Hi Dan,

I tested again, with dm-core, dm-aggregates and dm-postgres-adapter, all with branch "release-1.2", and now it works!
Thanks a lot for the quick fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants