aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/order.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/active_relation/relations/order.rb')
-rw-r--r--lib/active_relation/relations/order.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/active_relation/relations/order.rb b/lib/active_relation/relations/order.rb
new file mode 100644
index 0000000000..99ff939528
--- /dev/null
+++ b/lib/active_relation/relations/order.rb
@@ -0,0 +1,19 @@
+module ActiveRelation
+ module Relations
+ class Order < Compound
+ attr_reader :relation, :orders
+
+ def initialize(relation, *orders)
+ @relation, @orders = relation, orders
+ end
+
+ def ==(other)
+ relation == other.relation and orders.eql?(other.orders)
+ end
+
+ def qualify
+ Order.new(relation.qualify, *orders.collect { |o| o.qualify })
+ end
+ end
+ end
+end \ No newline at end of file