I'm following Michael Hartl tutorial and want to set a method to limit the amount of users a person can follow
Should I set the limit in the controller/relatiionships_controller.rb
app/model/relationships_controller.rb
validate :following_quota, :on => :create
private
def following_quota
if user.active_relationships.size >= 3
error.add(:base, 'exceeded follow limit')
end
end
or should i set this is the model/user.rb
Aucun commentaire:
Enregistrer un commentaire