Permalink
Browse files

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

  • Loading branch information...
1 parent d3487c8 commit d331a14dd2e61358b77051f9f7abc6aec70002d4 @maxwell maxwell committed Jun 17, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 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

0 comments on commit d331a14

Please sign in to comment.