Class: Trophy

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/trophy.rb

Instance Method Summary collapse

Instance Method Details

#count_within_limitObject


4
5
6
7
# File 'app/models/trophy.rb', line 4

def count_within_limit
  return if Trophy.where(user_id: user_id).count < 5
  errors.add(:base, "Exceeded trophy limit")
end