From d331a14dd2e61358b77051f9f7abc6aec70002d4 Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Sun, 17 Jun 2012 15:48:57 -0700 Subject: [PATCH] limit the amount of people in a converasation to prevent hella spam --- app/models/conversation.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/conversation.rb b/app/models/conversation.rb index 4fc891280..bdc3e123a 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -14,6 +14,12 @@ class Conversation < ActiveRecord::Base belongs_to :author, :class_name => 'Person' + validate :max_participants + + def max_participants + errors.add(:max_participants, "too many participants") if participants.count > 20 + end + accepts_nested_attributes_for :messages def recipients