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

aggegrates don't work in Ruby 2.0 #20

@strallhofer

Description

@strallhofer

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions