limit the amount of people in a converasation to prevent hella spam

This commit is contained in:
Maxwell Salzberg 2012-06-17 15:48:57 -07:00
parent d3487c8b7d
commit d331a14dd2

View file

@ -14,6 +14,12 @@ class Conversation < ActiveRecord::Base
belongs_to :author, :class_name => 'Person' 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 accepts_nested_attributes_for :messages
def recipients def recipients