Skip to content

Commit

Permalink
Use paginated_each since find_each/find_in_batches is buggy & bombing…
Browse files Browse the repository at this point in the history
… out.
  • Loading branch information
sudara committed Sep 23, 2011
1 parent eba5477 commit 31047f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/asset/statistics.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.gigs
end end


def self.update_hotness def self.update_hotness
Asset.find_each do |a| Asset.paginated_each do |a| # for some reason find_each doesn't work here...
# These use update_all so that they do not trigger callbacks and invalidate cache # These use update_all so that they do not trigger callbacks and invalidate cache
Asset.update_all "hotness = #{a.calculate_hotness}", "id = #{a.id}" Asset.update_all "hotness = #{a.calculate_hotness}", "id = #{a.id}"
Asset.update_all "listens_per_week = #{a.listens_per_week}", "id = #{a.id}" Asset.update_all "listens_per_week = #{a.listens_per_week}", "id = #{a.id}"
Expand Down

0 comments on commit 31047f0

Please sign in to comment.