module JamRuby class RsvpRequest < ActiveRecord::Base belongs_to :user, :class_name => "JamRuby::User" belongs_to :rsvp_slot, :class_name => "JamRuby::RsvpSlot" validates :message, length: {maximum: 1000}, no_profanity: true validates :chosen, :inclusion => {:in => [nil, true, false]} validates :canceled, :inclusion => {:in => [nil, true, false]} validates :rsvp_slot, presence: true # XXX we need to validate that only one RsvpRequest.chosen = true for a given RsvpSlot # in other words, you can have many requests to a slot, but only 0 or 1 rsvp_request.chosen = true) end end