diff options
-rw-r--r-- | lib/arel/select_manager.rb | 6 | ||||
-rw-r--r-- | spec/arel/select_manager_spec.rb | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index 678e289814..569b631c7f 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -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 diff --git a/spec/arel/select_manager_spec.rb b/spec/arel/select_manager_spec.rb index 883a518aca..5e4059084f 100644 --- a/spec/arel/select_manager_spec.rb +++ b/spec/arel/select_manager_spec.rb @@ -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 |