Sprankelprachtig aan/afmeldsysteem

subgroup.rb 358B

123456789101112131415
  1. class Subgroup < ApplicationRecord
  2. belongs_to :activity
  3. has_many :participants, dependent: :nullify
  4. validates :name, presence: true, uniqueness: { scope: :activity, case_sensitive: false }
  5. validates :activity, presence: true
  6. def participant_names
  7. participants
  8. .joins(:person)
  9. .map { |p| p.person.full_name }
  10. .sort
  11. end
  12. end