1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make as factory method convert alias name to SqlLiteral

This commit is contained in:
Ernie Miller 2011-03-12 10:53:47 +08:00 committed by Aaron Patterson
parent 21e052796d
commit 05887fc406
2 changed files with 7 additions and 1 deletions

View file

@ -1,7 +1,7 @@
module Arel
module Predications
def as other
Nodes::As.new self, other
Nodes::As.new self, Nodes::SqlLiteral.new(other)
end
def not_eq other

View file

@ -10,6 +10,12 @@ module Arel
assert_equal attr, as.left
assert_equal 'foo', as.right
end
it 'converts right to SqlLiteral if a string' do
attr = Table.new(:users)[:id]
as = attr.as('foo')
assert_kind_of Arel::Nodes::SqlLiteral, as.right
end
end
end
end