jeudi 10 septembre 2015

conditions on count column using counter catch rails 4

Relations:

vote.rb

belongs_to :user
belongs_to :celebrity, counter_cache: true

celebrity.rb

belongs_to :user
belongs_to :category
has_many :votes

I need to use conditions in vote model something like

belongs_to :celebrity, counter_cache: true, :conditions => ['votes.upvote = ? ', true]

can anyone help me here

Aucun commentaire:

Enregistrer un commentaire