Skip to content

キーノート招待作成時の user_id=nil Speaker の重複バリデーションエラーを修正#2748

Merged
jacopen merged 1 commit intomainfrom
fix/keynote-invitation-nil-user-validation
Mar 9, 2026
Merged

キーノート招待作成時の user_id=nil Speaker の重複バリデーションエラーを修正#2748
jacopen merged 1 commit intomainfrom
fix/keynote-invitation-nil-user-validation

Conversation

@takaishi
Copy link
Contributor

@takaishi takaishi commented Mar 9, 2026

概要

同一カンファレンス内に user_id = nil の暫定 Speaker が既に存在する場合、キーノート招待作成に失敗する問題を修正しました。

原因

Speaker に以下のバリデーションがあり、nil でも一意性チェックが実行されていました。

validates :user_id, uniqueness: { scope: :conference_id }

このため、同一 conference で2件目以降の暫定 Speaker(user_id IS NULL)作成時に重複と判定され、保存失敗していました。

変更内容

Speakeruser_id 一意性バリデーションに allow_nil: true を追加しました。

validates :user_id, uniqueness: { scope: :conference_id }, allow_nil: true

影響範囲

  • 同一カンファレンス内で user_id=nil の暫定 Speaker を複数作成可能になります。
  • user_id が入っているデータの一意性制約は従来通り維持されます。

@gitops-for-cloudnativedays gitops-for-cloudnativedays bot added the reviewapps Build ReviewApp environment automatically if this label is granted label Mar 9, 2026
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Mar 9, 2026
commit: cloudnativedaysjp/dreamkast@23ac89f
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22856088547

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

@takaishi takaishi changed the title Fix speaker uniqueness validation for nil user_id キーノート招待作成時の user_id=nil Speaker の重複バリデーションエラーを修正 Mar 9, 2026
@takaishi takaishi marked this pull request as ready for review March 9, 2026 13:39
@takaishi takaishi self-assigned this Mar 9, 2026
@takaishi takaishi requested a review from a team March 9, 2026 13:39
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Simplecov Report

Covered Threshold
65.93% 60%

Copy link
Collaborator

@jacopen jacopen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jacopen jacopen merged commit 341da9c into main Mar 9, 2026
12 checks passed
@jacopen jacopen deleted the fix/keynote-invitation-nil-user-validation branch March 9, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewapps Build ReviewApp environment automatically if this label is granted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants