Skip to content

Instantly share code, notes, and snippets.

@qcam
Created May 12, 2014 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qcam/5a3e39d135ed619b7e65 to your computer and use it in GitHub Desktop.
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