Skip to content

Commit bfd3a31

Browse files
committed
add explicit mention to select replacement in pluck API docs
1 parent 9eb52bf commit bfd3a31

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

activerecord/lib/active_record/relation/calculations.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ def calculate(operation, column_name)
287287
# # SELECT DATEDIFF(updated_at, created_at) FROM people
288288
# # => ['0', '27761', '173']
289289
#
290+
# Be aware that #pluck ignores any previous select clauses
291+
#
292+
# Person.select(:name).pluck(:id)
293+
# # SELECT people.id FROM people
294+
#
290295
# See also #ids.
291296
def pluck(*column_names)
292297
if @none

0 commit comments

Comments
 (0)