aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/calculations_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-07 11:13:15 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-01-07 11:13:15 +0900
commita194c527fa7b16840fd1b1250dc9f624c6536546 (patch)
tree3ac66e20f096f5d2df61bd1dc238b765f5a1f09e /activerecord/test/cases/calculations_test.rb
parent4f8d7024130411783d327cf978552135a2b62c30 (diff)
downloadrails-a194c527fa7b16840fd1b1250dc9f624c6536546.tar.gz
rails-a194c527fa7b16840fd1b1250dc9f624c6536546.tar.bz2
rails-a194c527fa7b16840fd1b1250dc9f624c6536546.zip
Fix `pluck` with eager loading to respect `offset`
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-rw-r--r--activerecord/test/cases/calculations_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index 5eda39a0c7..e682da6fed 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -688,6 +688,11 @@ class CalculationsTest < ActiveRecord::TestCase
assert_equal [], Topic.includes(:replies).limit(1).where("0 = 1").pluck(:id)
end
+ def test_pluck_with_includes_offset
+ assert_equal [5], Topic.includes(:replies).order(:id).offset(4).pluck(:id)
+ assert_equal [], Topic.includes(:replies).order(:id).offset(5).pluck(:id)
+ end
+
def test_pluck_not_auto_table_name_prefix_if_column_included
Company.create!(name: "test", contracts: [Contract.new(developer_id: 7)])
ids = Company.includes(:contracts).pluck(:developer_id)