Flowdock
method

pluck

Importance_2
v3.2.13 - Show latest stable - 1 note - Class: ActiveRecord::Calculations
pluck(column_name) public

This method is designed to perform select by a single column as direct SQL query Returns Array with values of the specified column name The values has same data type as column.

Examples:

Person.pluck(:id) # SELECT people.id FROM people
Person.uniq.pluck(:role) # SELECT DISTINCT role FROM people
Person.where(:confirmed => true).limit(5).pluck(:id)
Show source
Register or log in to add new notes.
January 8, 2015 - (v4.1.8)
1 thank

Text improvement

Where it says: without loading a bunch of records should say: without loading a bunch of columns/attributes Considering that record usually is a row.