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

adding taken method to return the limit value

This commit is contained in:
Aaron Patterson 2010-09-09 15:58:06 -07:00
parent ef85edac7b
commit 9efae8f92d
2 changed files with 14 additions and 1 deletions

View file

@ -8,8 +8,12 @@ module Arel
@ctx = @head.cores.last
end
def taken
@head.limit
end
def where_clauses
warn "STOP CALLING ME" if $VERBOSE
warn "where_clauses is deprecated" if $VERBOSE
to_sql = Visitors::ToSql.new @engine
@ctx.wheres.map { |c| to_sql.accept c }
end

View file

@ -26,6 +26,15 @@ module Arel
end
describe 'select manager' do
describe 'taken' do
it 'should return limit' do
table = Table.new :users
manager = Arel::SelectManager.new Table.engine
manager.take 10
check manager.taken.should == 10
end
end
describe 'insert' do
it 'uses the select FROM' do
engine = EngineProxy.new Table.engine