1
0
Fork 0
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:
Rafael França 2015-12-17 17:23:41 -02:00
commit 0167e1d2fb
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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