Class: UpdateRatingJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/update_rating_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject


4
5
6
7
8
9
10
# File 'app/jobs/update_rating_job.rb', line 4

def perform
  EventTracker.track 'Jobs', 'Rating update'

  Blog.find_each do |blog|
    blog.update_attribute :rating, blog.posts.sum(:views)
  end
end