diff --git a/models/vote.rb b/models/vote.rb index e6de9a7..04a9820 100644 --- a/models/vote.rb +++ b/models/vote.rb @@ -1,4 +1,10 @@ class Vote < ActiveRecord::Base belongs_to :user belongs_to :badge_change + + after_create do + if self.badge_change.votes.count > 2 + badge_change.accept! + end + end end