From 3a8a9979acab6a6f4c6d759521c052fe2ac46d2b Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 28 Jul 2016 23:31:09 +0900 Subject: `pluck` should use `records` (`load_target`) when `loaded?` is true --- activerecord/lib/active_record/relation/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation') diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index a97b71815a..24b1131752 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -160,7 +160,7 @@ module ActiveRecord # def pluck(*column_names) if loaded? && (column_names.map(&:to_s) - @klass.attribute_names - @klass.attribute_aliases.keys).empty? - return @records.pluck(*column_names) + return records.pluck(*column_names) end if has_include?(column_names.first) -- cgit v1.2.3