Rails does some gymnastics to use the Enumerable#sum method built into Ruby 2.4+, and it falls back to the ActiveSupport Enumerable#sum method to handle situations in which the Ruby method doesn't handle it, such as an Array of Strings. Unfortunately, DescriptiveStatistics' #sum method gets in the way and breaks things when the Array is empty.
Using Ruby 2.4.2 and Rails 5.1.4 with descriptive_statistics 2.5.1:
>> [].sum
#> NoMethodError: undefined method `each' for nil:NilClass
See this post on StackOverflow for details.
Rails does some gymnastics to use the Enumerable#sum method built into Ruby 2.4+, and it falls back to the ActiveSupport Enumerable#sum method to handle situations in which the Ruby method doesn't handle it, such as an Array of Strings. Unfortunately, DescriptiveStatistics' #sum method gets in the way and breaks things when the Array is empty.
Using Ruby 2.4.2 and Rails 5.1.4 with descriptive_statistics 2.5.1:
See this post on StackOverflow for details.