aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorZachary Scott <e@zzak.io>2015-04-12 17:58:56 -0700
committerZachary Scott <e@zzak.io>2015-04-12 17:58:56 -0700
commit055d9993b5a47ba126e3e6f7a533006bff9e715a (patch)
treed37777500c766109993df78da5fb6308a1f30e91 /activerecord/lib/active_record
parent558597c0f804ddd9e43e5966d4c0f3b371fa4ed7 (diff)
parenta9f2c124aff3f61bd9dc2a023c37955652209f52 (diff)
downloadrails-055d9993b5a47ba126e3e6f7a533006bff9e715a.tar.gz
rails-055d9993b5a47ba126e3e6f7a533006bff9e715a.tar.bz2
rails-055d9993b5a47ba126e3e6f7a533006bff9e715a.zip
Merge branch 'patch-1'
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/calculations.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb
index 8f16de3519..402b317d9c 100644
--- a/activerecord/lib/active_record/relation/calculations.rb
+++ b/activerecord/lib/active_record/relation/calculations.rb
@@ -130,9 +130,9 @@ module ActiveRecord
# the plucked column names, if they can be deduced. Plucking an SQL fragment
# returns String values by default.
#
- # Person.pluck(:id)
- # # SELECT people.id FROM people
- # # => [1, 2, 3]
+ # Person.pluck(:name)
+ # # SELECT people.name FROM people
+ # # => ['David', 'Jeremy', 'Jose']
#
# Person.pluck(:id, :name)
# # SELECT people.id, people.name FROM people
@@ -150,6 +150,8 @@ module ActiveRecord
# # SELECT DATEDIFF(updated_at, created_at) FROM people
# # => ['0', '27761', '173']
#
+ # See also +ids+.
+ #
def pluck(*column_names)
column_names.map! do |column_name|
if column_name.is_a?(Symbol) && attribute_alias?(column_name)