Use ActiveRecord::Relation#count with a block

This method used to ignore the block but in Rails 5.1 it uses
Enumerable#count.

See https://github.com/rails/rails/pull/24203/commits/58772397
This commit is contained in:
Javi Martín
2020-04-27 19:20:58 +02:00
parent 08679bc9cc
commit f2cdc31786

View File

@@ -87,7 +87,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
filters << {
name: heading.name,
id: heading.id,
count: investments.select { |i| i.heading_id == heading.id }.size
count: investments.count { |i| i.heading_id == heading.id }
}
end
end