Skip to content

Instantly share code, notes, and snippets.

@qcam
Created May 12, 2014 08:23
Show Gist options
  • Select an option

  • Save qcam/5a3e39d135ed619b7e65 to your computer and use it in GitHub Desktop.

Select an option

Save qcam/5a3e39d135ed619b7e65 to your computer and use it in GitHub Desktop.
[Active Record] How to get a single column's values into an array
User.where(:role => :admin).order(:username).pluck(:email)    #=> [admin1@example.com, admin2@example.com]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment