1
0
Fork 0
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:
Aaron Patterson 2010-09-10 17:05:10 -07:00
parent f0f6b7fb90
commit 54448c5209
2 changed files with 13 additions and 0 deletions

View file

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

View file

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