Skip to content

Instantly share code, notes, and snippets.

@swarut
Created October 18, 2012 07:02
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 swarut/3910236 to your computer and use it in GitHub Desktop.
Save swarut/3910236 to your computer and use it in GitHub Desktop.
Ruby : Using Shorthand Collect #ruby #collect #shorthand
# collect values from a particular field
@users.collect(&:email)
# collect values from a particular method
@users.collect(&method(:user_preferences_url))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment