Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Counter Cache Column

#23 Counter Cache Column

Apr 25, 2007 | 7 minutes | Performance, Active Record
If you need to display the record count for a has_many association, you can improve performance by caching that number in a column.
  • Download:
  • mp4Full Size H.264 Video (12.2 MB)
  • m4vSmaller H.264 Video (8.12 MB)
  • webmFull Size VP8 Video (20 MB)
  • ogvFull Size Theora Video (18.4 MB)