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:
parent
ef85edac7b
commit
9efae8f92d
2 changed files with 14 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue