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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user