#1138 ✓resolved
Christian Hoareau

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

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.

New-ticket Create new ticket

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

Attachments

Pages