diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2011-03-27 09:54:38 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2011-03-29 17:24:55 +0100 |
commit | 555d0163897601010ab1305f41ed393ec517b61e (patch) | |
tree | b6ff36c740894b0c52939bdfe6a0b021a5962235 /activerecord/test/cases/batches_test.rb | |
parent | a9dafbb28de3e34c31ebf184fbc4e2042c7ff207 (diff) | |
download | rails-555d0163897601010ab1305f41ed393ec517b61e.tar.gz rails-555d0163897601010ab1305f41ed393ec517b61e.tar.bz2 rails-555d0163897601010ab1305f41ed393ec517b61e.zip |
Quote find_in_batches ORDER BY clause [#6620 state:resolved]
Diffstat (limited to 'activerecord/test/cases/batches_test.rb')
-rw-r--r-- | activerecord/test/cases/batches_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb index dc0e0da4c5..6620464d6a 100644 --- a/activerecord/test/cases/batches_test.rb +++ b/activerecord/test/cases/batches_test.rb @@ -83,4 +83,14 @@ class EachTest < ActiveRecord::TestCase Post.find_in_batches(:batch_size => post_count + 1) {|batch| assert_kind_of Array, batch } end end + + def test_find_in_batches_should_quote_batch_order + c = Post.connection + assert_sql(/ORDER BY #{c.quote_table_name('posts')}.#{c.quote_column_name('id')}/) do + Post.find_in_batches(:batch_size => 1) do |batch| + assert_kind_of Array, batch + assert_kind_of Post, batch.first + end + end + end end |