Skip to content

Instantly share code, notes, and snippets.

@ysinc88
Last active August 29, 2015 14:17
Show Gist options
  • Save ysinc88/1028b01d03c946889a31 to your computer and use it in GitHub Desktop.
Save ysinc88/1028b01d03c946889a31 to your computer and use it in GitHub Desktop.
sum return values from loop
<% p.led_configurations.map(&:quantity).inject(:+) do |c| %>
<%= c.quantity %>
<% end %>
# outputs 200 300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment