Sprankelprachtig aan/afmeldsysteem

participant.rb 790B

123456789101112131415161718192021222324252627
  1. # A Participant represents the many-to-many relation between People and
  2. # Activities, and contains the information on whether or not the person plans
  3. # to be present at the activity.
  4. class Participant < ApplicationRecord
  5. # @!attribute is_organizer
  6. # @return [Boolean]
  7. # whether the person is an organizer for this event.
  8. #
  9. # @!attribute attending
  10. # @return [Boolean]
  11. # whether or not the person plans to attend the activity.
  12. #
  13. # @!attribute notes
  14. # @return [String]
  15. # a short text indicating any irregularities, such as arriving later or
  16. # leaving earlier.
  17. belongs_to :person
  18. belongs_to :activity
  19. validates :person_id,
  20. uniqueness: {
  21. scope: :activity_id,
  22. message: "person already participates in this activity"
  23. }
  24. end