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:
parent
21e052796d
commit
05887fc406
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue