mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
adding "orders" method
This commit is contained in:
parent
5eaf76df2d
commit
e7648f2692
2 changed files with 14 additions and 0 deletions
|
@ -89,6 +89,10 @@ module Arel
|
|||
self
|
||||
end
|
||||
|
||||
def orders
|
||||
@head.orders
|
||||
end
|
||||
|
||||
def wheres
|
||||
Compatibility::Wheres.new @engine, @ctx.wheres
|
||||
end
|
||||
|
|
|
@ -73,6 +73,16 @@ module Arel
|
|||
end
|
||||
end
|
||||
|
||||
describe 'orders' do
|
||||
it 'returns order clauses' do
|
||||
table = Table.new :users
|
||||
manager = Arel::SelectManager.new Table.engine
|
||||
order = table[:id]
|
||||
manager.order table[:id]
|
||||
check manager.orders.should == [order]
|
||||
end
|
||||
end
|
||||
|
||||
describe 'order' do
|
||||
it 'generates order clauses' do
|
||||
table = Table.new :users
|
||||
|
|
Loading…
Reference in a new issue