Last active
August 29, 2015 14:04
-
-
Save danott/77b22f9d2d045447c5ed to your computer and use it in GitHub Desktop.
ActiveSupport sum
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
# In rails console. | |
dumb = Struct.new(:field_with_name) | |
[dumb.new(1), dumb.new(2), dumb.new(3)].sum(&:field_with_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment