123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- class Participant < ApplicationRecord
-
-
-
-
-
-
-
-
-
-
-
-
- belongs_to :person
- belongs_to :activity
- validates :person_id,
- uniqueness: {
- scope: :activity_id,
- message: I18n.t('activities.errors.already_in')
- }
-
-
-
- def row_class
- if self.attending
- "success"
- elsif self.attending == false
- "danger"
- else
- "warning"
- end
- end
- def may_change?(person)
- self.activity.may_change?(person) ||
- self.person == person
- end
- end
|