Skip to content

Instantly share code, notes, and snippets.

@venetanji
Created August 27, 2010 12:55
Show Gist options
  • Save venetanji/553299 to your computer and use it in GitHub Desktop.
Save venetanji/553299 to your computer and use it in GitHub Desktop.
class FanCount
@queue = "FanCount"
include Mongoid::Document
field :page_id
field :fans
field :date
index :page_id, :unique => true, :background => true
class << self
def perform(id = nil)
unless id
Page.all.each do |page|
Resque.enqueue(self, page.id)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment