aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/batches.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-03-29 11:24:35 -0300
committerEmilio Tagua <miloops@gmail.com>2010-03-29 11:30:06 -0300
commit53ddbfc460f5a54d5b81e7bfbc1c5828f90488c1 (patch)
tree5b516ace4c533812de11501423b73b3e9ff35688 /activerecord/lib/active_record/relation/batches.rb
parent5f7bc47303933ec67700f6390c98d889f6d9b0d1 (diff)
downloadrails-53ddbfc460f5a54d5b81e7bfbc1c5828f90488c1.tar.gz
rails-53ddbfc460f5a54d5b81e7bfbc1c5828f90488c1.tar.bz2
rails-53ddbfc460f5a54d5b81e7bfbc1c5828f90488c1.zip
Warn scoped order and limit are ignored. [#4123 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record/relation/batches.rb')
-rw-r--r--activerecord/lib/active_record/relation/batches.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb
index cb57b445e5..1c61e7d450 100644
--- a/activerecord/lib/active_record/relation/batches.rb
+++ b/activerecord/lib/active_record/relation/batches.rb
@@ -50,6 +50,10 @@ module ActiveRecord
def find_in_batches(options = {})
relation = self
+ if orders.present? || taken.present?
+ ActiveRecord::Base.logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size")
+ end
+
if (finder_options = options.except(:start, :batch_size)).present?
raise "You can't specify an order, it's forced to be #{batch_order}" if options[:order].present?
raise "You can't specify a limit, it's forced to be the batch_size" if options[:limit].present?
@@ -77,4 +81,4 @@ module ActiveRecord
"#{@klass.table_name}.#{@klass.primary_key} ASC"
end
end
-end \ No newline at end of file
+end