Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class FanInfluencer < ActiveRecord::Base
include Counter::Cache
belongs_to :fan
belongs_to :influencer
counter_cache_on column: :fans_count,
relation: :influencer,
relation_class_name: 'Influencer',
wait: (ENV['CC_DEFERRED_DELAY_SECONDS'] || '20').to_i.seconds,
recalculation: true,
method: :update_fans_count
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment