mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #381 from carsonreinke/function_order
Add OrderPredications back into Nodes::Function
This commit is contained in:
commit
0167e1d2fb
2 changed files with 10 additions and 0 deletions
|
@ -3,6 +3,7 @@ module Arel
|
|||
class Function < Arel::Nodes::Node
|
||||
include Arel::Predications
|
||||
include Arel::WindowPredications
|
||||
include Arel::OrderPredications
|
||||
attr_accessor :expressions, :alias, :distinct
|
||||
|
||||
def initialize expr, aliaz = nil
|
||||
|
|
|
@ -21,4 +21,13 @@ describe Arel::Nodes::Sum do
|
|||
assert_equal 2, array.uniq.size
|
||||
end
|
||||
end
|
||||
|
||||
describe 'order' do
|
||||
it 'should order the sum' do
|
||||
table = Arel::Table.new :users
|
||||
table[:id].sum.desc.to_sql.must_be_like %{
|
||||
SUM("users"."id") DESC
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue