Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit d331a14dd2e61358b77051f9f7abc6aec70002d4 1 parent d3487c8
@maxwell maxwell authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 app/models/conversation.rb
View
6 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
Please sign in to comment.
Something went wrong with that request. Please try again.