1 2 3 4
class Subscription < ActiveRecord::Base belongs_to :subscriber, counter_cache: :books_count belongs_to :book end