diff options
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/algebra/ordering.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/arel/algebra/ordering.rb b/lib/arel/algebra/ordering.rb index 8439e937a9..984327aaf7 100644 --- a/lib/arel/algebra/ordering.rb +++ b/lib/arel/algebra/ordering.rb @@ -1,5 +1,5 @@ module Arel - class Ordering + class Ordering < Struct.new(:attribute) delegate :relation, :to => :attribute def bind(relation) @@ -9,15 +9,14 @@ module Arel def to_ordering self end + + def == other + super || (self.class === other && attribute == other.attribute) + end end class Ascending < Ordering - attributes :attribute - deriving :initialize, :== end - class Descending < Ordering - attributes :attribute - deriving :initialize, :== end end |