
Collection#count does not work after building a Collection with Collection#union
Reported by Roger Braun | November 11th, 2009 @ 01:14 PM
If you build a Collection as a union of two other Collections and try to count it, you receive the error +options[:fields]+ should not be empty if +options[:unique]+ is false. This is the case even with the union of two empty collections.
Steps to reproduce:
>> @a = Entry.all(:titel => "foo")
=> []
>> @a.count
=> 0
>> @c = Entry.all(:titel => "bar")
=> []
>> @c.count
=> 0
>> @b = @a.union(@c)
=> []
>> @b.count
ArgumentError: +options[:fields]+ should not be empty if +options[:unique]+ is false
Comments and changes to this ticket
-
Dan Kubb (dkubb) November 11th, 2009 @ 01:51 PM
- State changed from new to accepted
- Assigned user set to Dan Kubb (dkubb)
-
Dan Kubb (dkubb) November 11th, 2009 @ 01:56 PM
(from [b2183c8060e0a070d72fb1f6441094297a6aa817]) Removed unecessary assertion when validating Query#fields
- This test causes conflicts with unioned Collections, and is invalid since it is perfectly reasonable to count on a Collection where Query#unique == false.
[#1121] http://github.com/datamapper/dm-core/commit/b2183c8060e0a070d72fb1f...
-
Dan Kubb (dkubb) November 11th, 2009 @ 01:56 PM
- State changed from accepted to resolved
(from [9dea5afdb76a43f1683c4e50b8a1af113eb95ed0]) Added specs to ensure Unioned Collections work with aggregate functions
- This corresponds with fixes made in dm-core that allow these specs to pass.
[#1121 state:resolved] http://github.com/datamapper/dm-more/commit/9dea5afdb76a43f1683c4e5...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Tags
Referenced by
-
1121 Collection#count does not work after building a Collection with Collection#union [#1121] http://github.com/datamapper/dm-core/commit/b218...
-
1121 Collection#count does not work after building a Collection with Collection#union [#1121 state:resolved] http://github.com/datamapper/dm-m...