Created
October 18, 2012 07:02
-
-
Save swarut/3910236 to your computer and use it in GitHub Desktop.
Ruby : Using Shorthand Collect #ruby #collect #shorthand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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