Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
Auto accept badge if votes > 2
Browse files Browse the repository at this point in the history
  • Loading branch information
halfdan committed Jan 30, 2016
1 parent 5e1a9fc commit fb2d683
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions models/vote.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fb2d683

Please sign in to comment.