Makes tags count only visible debates and proposals

This commit is contained in:
kikito
2015-09-17 16:54:10 +02:00
parent d71a404661
commit 8ff8a1df7f
5 changed files with 52 additions and 2 deletions

View File

@@ -105,6 +105,14 @@ class Proposal < ActiveRecord::Base
cached_votes_up)
end
def after_hide
self.tags.each{ |t| t.decrement_custom_counter_for('Proposal') }
end
def after_restore
self.tags.each{ |t| t.increment_custom_counter_for('Proposal') }
end
def self.title_max_length
@@title_max_length ||= self.columns.find { |c| c.name == 'title' }.limit || 80
end