aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-01 12:40:19 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-01 12:40:19 -0300
commit4e63bde623a0478ec55bcbfbe1afd8b4938148c8 (patch)
treea72e1caa12f5c7db65851147c5a1da370025783b /activerecord/lib/active_record
parentbdfc662a1195d13e3ef78cc8e79df8a8a2e3ca97 (diff)
parent777fa257aaa962bf67f6e5522efaa420ea7dc88b (diff)
downloadrails-4e63bde623a0478ec55bcbfbe1afd8b4938148c8.tar.gz
rails-4e63bde623a0478ec55bcbfbe1afd8b4938148c8.tar.bz2
rails-4e63bde623a0478ec55bcbfbe1afd8b4938148c8.zip
Merge pull request #20362 from kddeisz/enumerable_pluck
Allow Enumerable#pluck to take a splat.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/calculations.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb
index 402b317d9c..7a28a98721 100644
--- a/activerecord/lib/active_record/relation/calculations.rb
+++ b/activerecord/lib/active_record/relation/calculations.rb
@@ -161,6 +161,10 @@ module ActiveRecord
end
end
+ if loaded? && (column_names - @klass.column_names).empty?
+ return @records.pluck(*column_names)
+ end
+
if has_include?(column_names.first)
construct_relation_for_association_calculations.pluck(*column_names)
else