Skip to content

Fix NoMethodError when validating a child event with no start date - #4213

Open
SAY-5 wants to merge 1 commit into
osunyorg:mainfrom
SAY-5:fix-child-event-missing-start-date
Open

Fix NoMethodError when validating a child event with no start date#4213
SAY-5 wants to merge 1 commit into
osunyorg:mainfrom
SAY-5:fix-child-event-missing-start-date

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 18, 2026

Copy link
Copy Markdown

Type

  • Nouvelle fonctionnalité
  • Bug
  • Ajustement
  • Rangement

Description

Fixes #4189.

When a child event is submitted without a start date, in_parent_dates? runs from_day < parent.from_day and raises NoMethodError: undefined method '<' for nil instead of returning a validation error. from_day already has a presence: true validation, so the missing date is reported anyway once this comparison stops crashing. This guards in_parent_dates? to skip the range check when from_day or to_day is nil, matching how the SQL-based no_child_before?/no_child_after? siblings already tolerate nil.

Added a model test for a child event with no start date. It needs the full Rails/Postgres test harness to run, which I could not stand up locally, but it mirrors the existing event_test.rb cases.

Niveau d'incidence

  • Incidence faible 😌
  • Incidence moyenne 😲
  • Incidence forte 😱

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NoMethodError in admin/communication/websites/agenda/events#create

1 participant