#1060 ✓resolved

Composite keys can't be used for ordering

Reported by bodhi | September 25th, 2009 @ 02:19 AM | in 0.10.2

class NoId
  include DataMapper::Resource
  property :not_id, Integer, :key => true
  property :other_key, Integer, :key => true
irb(main):002:0> NoId.all :order => [:other_key]
 ~ (0.000036) SELECT "not_id", "other_key" FROM "no_ids" ORDER BY "other_key"

Seems ok...

irb(main):003:0> NoId.all :not_id => 1, :order => [:other_key]
 ~ (0.000554) SELECT "not_id", "other_key" FROM "no_ids" WHERE "not_id" = 1

The order by clause is ignored when any of the properties of the composite key are used in the conditions.

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