We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a59268 commit 827126dCopy full SHA for 827126d
app/controllers/members/participants_controller.rb
@@ -176,7 +176,7 @@ def participant_limit_check?
176
end
177
178
def participant_alcohol_check?
179
- @activity.is_alcoholic? && @member.underage?
+ @activity.is_alcoholic? && @member.underage_at?(@activity.start)
180
181
182
# [PATCH] /activities/:id/participants
app/models/member.rb
@@ -246,6 +246,11 @@ def underage?
246
!adult?
247
248
249
+ def underage_at?(event_date)
250
+ return birth_date.blank? ||
251
+ ((18.years.ago + (event_date - Date.today)) < birth_date)
252
+ end
253
+
254
def master?
255
educations.any? do |education|
256
education.status == 'active' && Study.find(education.study_id).masters
0 commit comments