Skip to content

Commit

Permalink
fix scores count
Browse files Browse the repository at this point in the history
  • Loading branch information
comorebi-notes committed Jan 22, 2018
1 parent f5bd89d commit 406b1ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/score.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ class Score < ApplicationRecord
belongs_to :user, optional: true
has_many :favs, dependent: :destroy

counter_culture :user, column_names: { ["scores.status = ?", '0'] => :scores_count }
counter_culture :user,
column_name: -> (score) { score.published? ? :scores_count : nil },
column_names: { ["scores.status = ?", '0'] => :scores_count }

paginates_per 20

Expand Down

0 comments on commit 406b1ec

Please sign in to comment.