Counter Cache for a column with conditions?

后端 未结 4 1641
旧时难觅i
旧时难觅i 2020-11-30 06:34

I am new to the concept of counter caching and with some astronomical load times on one of my app\'s main pages, I believe I need to get going on it.

Most of the coun

4条回答
  •  死守一世寂寞
    2020-11-30 07:13

    Check counter_culture gem:

    counter_culture :category, column_name: Proc.new {|project| project.complete? ? 'complete_count' : nil }
    

提交回复
热议问题