ref: master
plugins/vote/lib/ext/vote.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
require_dependency 'models/vote' class Vote validate :verify_target_archived def verify_target_archived if voteable.kind_of?(Article) || voteable.kind_of?(Comment) if voteable.archived? errors.add(:base, _("The target is achived and can't accept votes")) false end end end end |