Inject error when no default value is given?


Calling inject with no parameter copies the first element of the enumerable into the accumulator. In this case it fills it with the first attendee. It never calls 'participants' on it.

This works fine when you are using it on numbers, but runs into trouble with more complicated data types.

Doing this would probably work as you expect. {|sum,att| sum + att}