
Collection#last does behave correctly when [:id.asc] order is supplied
Reported by Christian Hoareau | November 30th, 2009 @ 03:17 AM | in 0.10.2
Read: Collection#last does NOT behave correctly when [:id.asc] order is supplied
Create a dummy model
class Foo
include DataMapper::Resource
property :id, Serial
property :name, String
end
Create dummy records
Foo.new(:name => 'alice').save; Foo.new(:name => 'bob').save
Observe the incorrect behavior
The following expression returns false
as
expected:
Foo.all(:order => [:name.asc]).last == Foo.all(:order => [:name.desc]).last # => false
But the following expression returns true
;
[:id.asc]
is ignored:
Foo.all(:order => [:id.asc]).last == Foo.all(:order => [:id.desc]).last # => true
Comments and changes to this ticket
-
Dan Kubb (dkubb) November 30th, 2009 @ 01:44 PM
- Assigned user set to Dan Kubb (dkubb)
- State changed from new to accepted
- Milestone set to 0.10.2
-
Dan Kubb (dkubb) November 30th, 2009 @ 02:09 PM
- State changed from accepted to resolved
- Tag cleared.
@Christian: This appears to be resolved with edge dm-core. Can you try installing edge dm-core using the instructions linked to from here and let me know if it resolves your problem? http://bit.ly/8p4APZ
I've also attached a test script with the output I get when running it locally.
-
Christian Hoareau November 30th, 2009 @ 11:20 PM
@Dan: Latest dm-core does resolve the problem. Thank you!
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 »