Skip to content

Instantly share code, notes, and snippets.

@aldesantis
Created June 2, 2016 12:20
Show Gist options
  • Save aldesantis/19c8cb5cb0772a055e41cb624909443c to your computer and use it in GitHub Desktop.
Save aldesantis/19c8cb5cb0772a055e41cb624909443c to your computer and use it in GitHub Desktop.
class Book < ActiveRecord::Base
has_many :reviews
end
class Review < ActiveRecord::Base
belongs_to :book, counter_cache: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment