mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
adding some backwards compatibility for AR
This commit is contained in:
parent
f0f6b7fb90
commit
54448c5209
2 changed files with 13 additions and 0 deletions
|
@ -63,6 +63,8 @@ module Arel
|
|||
end
|
||||
|
||||
def having expr
|
||||
expr = Nodes::SqlLiteral.new(expr) if String === expr
|
||||
|
||||
@ctx.having = Nodes::Having.new(expr)
|
||||
self
|
||||
end
|
||||
|
|
|
@ -26,6 +26,17 @@ module Arel
|
|||
end
|
||||
|
||||
describe 'select manager' do
|
||||
describe 'backwards compatibility' do
|
||||
describe '#having' do
|
||||
it 'converts strings to SQLLiterals' do
|
||||
table = Table.new :users
|
||||
mgr = table.from table
|
||||
mgr.having 'foo'
|
||||
mgr.to_sql.should be_like %{ SELECT FROM "users" HAVING foo }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'skip' do
|
||||
it 'should add an offset' do
|
||||
table = Table.new :users
|
||||
|
|
Loading…
Reference in a new issue