Category.all.map(&:id)
is shorthand for
Category.all.map { |a| a.id }
as for how it affects the rest of the line, the above section returns all id
values as a single Array
. This Array
of ids is then passed into another call to each
, which iteratively passes each id into reset_counters
.