Here's the line of code I'm trying to wrap my head around:
Category.all.map(&:id).each { |id| Category.reset_counters(id, :products) }
Hoping someone can help me understand what (&:id)
is doing and how it impacts the rest of the line? I believe it turns the symbol :id
into a proc that'll respond to id
?!? But then it gets confusing...
Thanks in advance!