Skip to content

Instantly share code, notes, and snippets.

@danott
Last active August 29, 2015 14:04
Show Gist options
  • Save danott/77b22f9d2d045447c5ed to your computer and use it in GitHub Desktop.
Save danott/77b22f9d2d045447c5ed to your computer and use it in GitHub Desktop.
ActiveSupport sum
# 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