Skip to content

OrganizerをRegularEventOrganizerにリネームした#9715

Closed
yokomaru wants to merge 1 commit intomainfrom
chore/prepare-for-rename-of-organizers-table
Closed

OrganizerをRegularEventOrganizerにリネームした#9715
yokomaru wants to merge 1 commit intomainfrom
chore/prepare-for-rename-of-organizers-table

Conversation

@yokomaru
Copy link
Copy Markdown
Contributor

@yokomaru yokomaru commented Mar 3, 2026

Issue

概要

  • RegularEventUserの中間モデルのOrganizerRegularEventOrganizersにリネームした
  • モデルのリネームに伴いリレーション名も変更
  • 実際の業務を想定して段階的に対応するため、テーブル名の変更は別のPRで対応予定のため先にモデル名を修正

変更確認方法

  1. chore/prepare-for-rename-of-organizers-tableをローカルに取り込む
  2. 定期イベントが作成できること
    • 主催者を登録し作成できていることが確認できていればOK

Summary by CodeRabbit

リリースノート

  • Refactor

    • 内部コード構造を整理しました。ユーザー向けの機能変更はありません。
  • Tests

    • テストコードを更新し、内部構造の変更に対応させました。

@github-actions github-actions bot requested a review from okuramasafumi March 3, 2026 07:54
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 3, 2026

📝 Walkthrough

Walkthrough

Organizer モデルを RegularEventOrganizer に名前変更し、関連するアソシエーションとスコープを更新しました。コントローラ、モデル、テスト、フィクスチャ全体で一貫性を持たせ、命名の競合を解決しています。

Changes

Cohort / File(s) Summary
Model Rename
app/models/regular_event_organizer.rb
Organizer クラスを RegularEventOrganizer に名前変更し、テーブル名マッピング self.table_name = 'organizers' を追加。
Model Associations Update
app/models/regular_event.rb, app/models/user.rb
has_many :organizershas_many :regular_event_organizers に更新。スコープ organizer_eventregular_event_organizers 経由で結合するよう変更。
Controller Update
app/controllers/regular_events_controller.rb
Organizer.create() の呼び出しを RegularEventOrganizer.create() に変更。
Tests
test/models/organizer_test.rb, test/models/regular_event_organizers_test.rb, test/models/user_test.rb
古いテストファイルを削除し、RegularEventOrganizerTest を追加。テスト内の Organizer 参照を RegularEventOrganizer に更新。
Fixtures
db/fixtures/organizers.yml, test/fixtures/organizers.yml
フィクスチャに _fixture セクションを追加し、model_class: RegularEventOrganizer を指定。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • komagata

Poem

🐰 モデルを整理し、名前を変更し、
古きオーガナイザーは新しき姿へ。
RegularEventOrganizer と呼ばれて、
コードは美しく、競合は消えて、
テストも新しく、フィクスチャも整う! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed タイトルはプルリクエストの主要な変更内容(OrganizerモデルをRegularEventOrganizerにリネーム)を明確に要約しており、変更セット全体と完全に関連している。
Description check ✅ Passed プルリクエストの説明は、テンプレートの全セクション(Issue、概要、変更確認方法)を含み、具体的な内容で埋められています。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/prepare-for-rename-of-organizers-table

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
app/models/regular_event.rb (1)

126-126: 主催者自動割当の保存失敗を検出できるようにしたいです。

save の戻り値を見ていないため、失敗が見えません。ここは例外を上げる形のほうが不整合を早く検知できます。

修正案
-    RegularEventOrganizer.new(user: admin_user, regular_event: self).save if admin_user
+    RegularEventOrganizer.create!(user: admin_user, regular_event: self) if admin_user
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/models/regular_event.rb` at line 126, The current call
RegularEventOrganizer.new(user: admin_user, regular_event: self).save ignores
the boolean result so failures are silent; change it to use the bang version to
surface errors, e.g. call save! (RegularEventOrganizer.new(...).save!) or
explicitly check the return value and raise an exception with the
organizer.errors.full_messages if false so a failure to assign the organizer
raises immediately.
test/test_helper.rb (1)

39-40: fixtures :organizers は重複指定です。

Line 38 の fixtures :allorganizers も対象になるため、Line 40 は削っても挙動は変わりません。重複をなくすと意図が明確になります。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/test_helper.rb` around lines 39 - 40, The test helper declares fixtures
twice for organizers: after set_fixture_class organizers: RegularEventOrganizer
remove the redundant fixtures :organizers line because fixtures :all (declared
earlier) already loads organizers; delete the standalone "fixtures :organizers"
entry so only fixtures :all and the set_fixture_class mapping remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/controllers/regular_events_controller.rb`:
- Line 32: RegularEventOrganizer.create is called without checking its result so
organizer-creation failures are swallowed; replace or guard this call
(RegularEventOrganizer.create) so failures are handled: either use
RegularEventOrganizer.create! inside the surrounding transaction/rescue block to
raise on validation errors, or check the returned record (e.g. created =
RegularEventOrganizer.create(...); unless created.persisted? then
handle/rollback and render or raise) referencing current_user and `@regular_event`
to locate the call, and ensure the controller responds with an error (or
rollbacks the transaction) when organizer creation fails.

---

Nitpick comments:
In `@app/models/regular_event.rb`:
- Line 126: The current call RegularEventOrganizer.new(user: admin_user,
regular_event: self).save ignores the boolean result so failures are silent;
change it to use the bang version to surface errors, e.g. call save!
(RegularEventOrganizer.new(...).save!) or explicitly check the return value and
raise an exception with the organizer.errors.full_messages if false so a failure
to assign the organizer raises immediately.

In `@test/test_helper.rb`:
- Around line 39-40: The test helper declares fixtures twice for organizers:
after set_fixture_class organizers: RegularEventOrganizer remove the redundant
fixtures :organizers line because fixtures :all (declared earlier) already loads
organizers; delete the standalone "fixtures :organizers" entry so only fixtures
:all and the set_fixture_class mapping remain.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffad791 and f5ee552.

📒 Files selected for processing (8)
  • app/controllers/regular_events_controller.rb
  • app/models/regular_event.rb
  • app/models/regular_event_organizer.rb
  • app/models/user.rb
  • test/models/organizer_test.rb
  • test/models/regular_event_organizers_test.rb
  • test/models/user_test.rb
  • test/test_helper.rb
💤 Files with no reviewable changes (1)
  • test/models/organizer_test.rb

if @regular_event.save
update_published_at
Organizer.create(user_id: current_user.id, regular_event_id: @regular_event.id)
RegularEventOrganizer.create(user_id: current_user.id, regular_event_id: @regular_event.id)
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Mar 3, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

git ls-files app/controllers/regular_events_controller.rb app/models/regular_event*.rb

Repository: fjordllc/bootcamp

Length of output: 343


🏁 Script executed:

head -50 app/controllers/regular_events_controller.rb

Repository: fjordllc/bootcamp

Length of output: 1544


🏁 Script executed:

cat -n app/controllers/regular_events_controller.rb | sed -n '20,45p'

Repository: fjordllc/bootcamp

Length of output: 903


🏁 Script executed:

fd -t f "regular_event" app/models/ | head -20

Repository: fjordllc/bootcamp

Length of output: 298


🏁 Script executed:

find app/models -name "*regular_event*" -o -name "*organizer*" | head -20

Repository: fjordllc/bootcamp

Length of output: 361


🏁 Script executed:

cat -n app/models/regular_event_organizer.rb

Repository: fjordllc/bootcamp

Length of output: 516


🏁 Script executed:

cat -n app/models/regular_event.rb | head -80

Repository: fjordllc/bootcamp

Length of output: 3139


🏁 Script executed:

rg -A 3 "class RegularEventOrganizer" app/models/

Repository: fjordllc/bootcamp

Length of output: 709


🏁 Script executed:

rg "EventOrganizer\." app/controllers/ -A 2 -B 2

Repository: fjordllc/bootcamp

Length of output: 582


🏁 Script executed:

rg "\.create\(" app/controllers/regular_events_controller.rb

Repository: fjordllc/bootcamp

Length of output: 158


🏁 Script executed:

rg "find_or_create_by" app/ --include="*.rb" | head -20

Repository: fjordllc/bootcamp

Length of output: 502


🏁 Script executed:

rg "create!" app/controllers/ -A 1 -B 1 | head -30

Repository: fjordllc/bootcamp

Length of output: 761


🏁 Script executed:

rg -B 5 -A 5 "RegularEventOrganizer" app/controllers/

Repository: fjordllc/bootcamp

Length of output: 1017


🏁 Script executed:

rg "find_or_create_by!" app/controllers/ -B 2 -A 2 | head -40

Repository: fjordllc/bootcamp

Length of output: 43


🏁 Script executed:

rg "\.create\!" app/models/regular_event.rb -B 2 -A 2

Repository: fjordllc/bootcamp

Length of output: 145


🏁 Script executed:

rg "create!" app/models/regular_event.rb -B 2 -A 2

Repository: fjordllc/bootcamp

Length of output: 43


🏁 Script executed:

rg "transaction" app/controllers/regular_events_controller.rb

Repository: fjordllc/bootcamp

Length of output: 43


🏁 Script executed:

cat -n app/models/regular_event.rb | sed -n '140,200p'

Repository: fjordllc/bootcamp

Length of output: 2223


🏁 Script executed:

rg "regular_event_organizers" app/models/regular_event.rb -B 2 -A 2

Repository: fjordllc/bootcamp

Length of output: 999


🏁 Script executed:

rg "find_or_create_by" app/ -B 1 -A 1 | head -40

Repository: fjordllc/bootcamp

Length of output: 569


🏁 Script executed:

cat -n app/controllers/regular_events_controller.rb | sed -n '26,40p'

Repository: fjordllc/bootcamp

Length of output: 655


🏁 Script executed:

rg "set_all_user_participants_and_watchers" app/controllers/regular_events_controller.rb -A 10

Repository: fjordllc/bootcamp

Length of output: 865


🏁 Script executed:

rg "find_or_create_by" app/models/ -B 1 -A 3 | head -50

Repository: fjordllc/bootcamp

Length of output: 818


🏁 Script executed:

rg "belongs_to :user" app/models/regular_event_organizer.rb -B 1 -A 5

Repository: fjordllc/bootcamp

Length of output: 201


主催者レコード作成失敗が握りつぶされます。

create メソッドは検証失敗時に例外を発生させず、戻り値も確認していないため、作成失敗時でも成功フローが続行されます。主催者関係が紐付けられず、イベントが不完全な状態になるリスクがあります。

修正案
-      RegularEventOrganizer.create(user_id: current_user.id, regular_event_id: `@regular_event.id`)
+      RegularEventOrganizer.find_or_create_by!(user: current_user, regular_event: `@regular_event`)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RegularEventOrganizer.create(user_id: current_user.id, regular_event_id: @regular_event.id)
RegularEventOrganizer.find_or_create_by!(user: current_user, regular_event: `@regular_event`)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/controllers/regular_events_controller.rb` at line 32,
RegularEventOrganizer.create is called without checking its result so
organizer-creation failures are swallowed; replace or guard this call
(RegularEventOrganizer.create) so failures are handled: either use
RegularEventOrganizer.create! inside the surrounding transaction/rescue block to
raise on validation errors, or check the returned record (e.g. created =
RegularEventOrganizer.create(...); unless created.persisted? then
handle/rollback and render or raise) referencing current_user and `@regular_event`
to locate the call, and ensure the controller responds with an error (or
rollbacks the transaction) when organizer creation fails.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

既存の定期イベントに自動で作成者を主催者を作成する機能のバグなので別Issueとして対応いたします。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@yokomaru さん、承知いたしました。PRのスコープを維持し、別Issueで対応されるのは適切な判断だと思います。

この問題(RegularEventOrganizerの作成失敗時のエラーハンドリング)について、GitHubのIssueを作成しますか?必要であれば、適切なタイトルと説明文を付けてIssueを作成させていただきます。


🧠 Learnings used
Learnt from: yokomaru
Repo: fjordllc/bootcamp PR: 9505
File: test/fixtures/regular_events.yml:253-262
Timestamp: 2026-01-15T06:30:59.321Z
Learning: fjordllc/bootcamp の RegularEvent モデルにおいて、`user` フィールドは「作成者」を意味し、主催者は別途 Organizer モデルで管理されている。通常は作成者 = 主催者のパターンが多いが、システム上は分離されている設計である。

Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T21:11:21.826Z
Learning: fjordllc/bootcampプロジェクトの`app/models/inquiry_notifier.rb`において、`NOTIFICATION_SENDER_NAME`で指定される管理者ユーザーは必ず存在することがシステムの前提条件として保証されているため、senderがnilになることは想定されておらず、エラーハンドリングは不要である。

Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 8977
File: app/controllers/reports_controller.rb:63-63
Timestamp: 2025-07-23T20:31:13.856Z
Learning: fjordllc/bootcampプロジェクトの`app/controllers/reports_controller.rb`において、`create`と`update`アクションは両方とも`report.save_uniquely`を使用し、同じ`:report_save`イベントと`'report.save'`イベントを発行する。これは両方とも本質的に「レポートの保存」操作であり、作成と更新を区別する必要がないためである。

Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/controllers/pair_works_controller.rb:10-18
Timestamp: 2026-01-08T21:12:18.350Z
Learning: In fjordllc/bootcamp, when using ActiveRecord.order to specify ascending order, omit the explicit :asc and rely on Rails' default ASC behavior. Prefer .order(:published_at) over .order(published_at: :asc). If you need a non-default order (e.g., DESC), specify it explicitly. This guideline applies to Ruby/Rails controller and model files, especially in app/controllers and similar ActiveRecord usage sites.

Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/helpers/pair_work_helper.rb:31-33
Timestamp: 2026-01-15T03:20:24.643Z
Learning: In this Ruby project, prefer Numeric#hours (plural) for adding time durations. Use the plural hours method when converting integers to durations (e.g., hour_count.hours). Apply this consistently across the codebase to ensure uniform time calculations and Rails-style duration handling.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

このリポジトリに登録してあるバグレポートのフォーマットに沿って作成お願いします。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

@yokomaru さん、承知いたしました。リポジトリのバグレポートフォーマットを確認して、Issue を作成させていただきます。


🏁 Script executed:

#!/bin/bash
# Find bug report template in the repository
fd -t f "bug" .github/ 2>/dev/null || find .github -name "*bug*" -o -name "*issue*" 2>/dev/null | head -10

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check common locations for issue templates
cat .github/ISSUE_TEMPLATE/bug_report.md 2>/dev/null || \
cat .github/ISSUE_TEMPLATE/bug.md 2>/dev/null || \
cat .github/ISSUE_TEMPLATE.md 2>/dev/null || \
ls -la .github/ISSUE_TEMPLATE/ 2>/dev/null || \
echo "Template not found, checking for any markdown files in .github"
find .github -name "*.md" -o -name "*.yml" -o -name "*.yaml" | head -20

Length of output: 675


🏁 Script executed:

#!/bin/bash
# Read all markdown files in ISSUE_TEMPLATE directory
echo "=== First template file ==="
cat .github/ISSUE_TEMPLATE/*.md | head -100

Length of output: 541


🏁 Script executed:

#!/bin/bash
# List files with full names
ls -1 .github/ISSUE_TEMPLATE/

Length of output: 16


🏁 Script executed:

#!/bin/bash
# Read each file separately
for file in .github/ISSUE_TEMPLATE/*.md; do
  echo "=== File: $file ==="
  cat "$file"
  echo ""
  echo "---"
  echo ""
done

Length of output: 616


🏁 Script executed:

#!/bin/bash
# Create GitHub issue using the bug report template format
gh issue create \
  --title "RegularEventOrganizer作成失敗時のエラーハンドリング不足" \
  --label "バグ" \
  --assignee "yokomaru" \
  --body "## 概要

\`app/controllers/regular_events_controller.rb\` の \`create\` アクション内で、\`RegularEventOrganizer.create\` が呼ばれていますが、作成失敗時のエラーハンドリングがないため、主催者レコードの作成に失敗しても処理が継続され、不完全な状態のイベントが作成される可能性があります。

## 再現手順

1. 定期イベントの新規作成画面にアクセス。
2. 必要な情報を入力して「作成」をクリック。
3. \`RegularEventOrganizer\` のバリデーションが失敗する条件(例: データベース制約違反など)が発生した場合、エラーが握りつぶされ、主催者が紐付けられていないイベントが作成される。

## 期待される振る舞い

\`RegularEventOrganizer\` の作成に失敗した場合は、適切なエラーハンドリング(例外の発生、トランザクションのロールバック、エラーメッセージの表示など)が行われるべきです。

## スクリーンショット

該当なし

## 環境

該当なし(コードレベルの問題)

## 関連Issue

- 関連PR: `#9715`
- コメント: https://github.com/fjordllc/bootcamp/pull/9715#discussion_r2876736798
- 報告者: `@yokomaru`"

Length of output: 88


🏁 Script executed:

#!/bin/bash
# Create GitHub issue using the bug report template format
gh issue create \
  --title "RegularEventOrganizer作成失敗時のエラーハンドリング不足" \
  --label "バグ" \
  --assignee "yokomaru" \
  --body "## 概要

\`app/controllers/regular_events_controller.rb\` の \`create\` アクション内で、\`RegularEventOrganizer.create\` が呼ばれていますが、作成失敗時のエラーハンドリングがないため、主催者レコードの作成に失敗しても処理が継続され、不完全な状態のイベントが作成される可能性があります。

## 再現手順

1. 定期イベントの新規作成画面にアクセス。
2. 必要な情報を入力して「作成」をクリック。
3. \`RegularEventOrganizer\` のバリデーションが失敗する条件(例: データベース制約違反など)が発生した場合、エラーが握りつぶされ、主催者が紐付けられていないイベントが作成される。

## 期待される振る舞い

\`RegularEventOrganizer\` の作成に失敗した場合は、適切なエラーハンドリング(例外の発生、トランザクションのロールバック、エラーメッセージの表示など)が行われるべきです。

## スクリーンショット

該当なし

## 環境

該当なし(コードレベルの問題)

## 関連Issue

- 関連PR: `#9715`
- コメント: https://github.com/fjordllc/bootcamp/pull/9715#discussion_r2876736798
- 報告者: `@yokomaru`"

Length of output: 48


@yokomaru さん、バグレポートのフォーマットに沿って Issue を作成いたしました。

作成された Issue:
#9716

「RegularEventOrganizer作成失敗時のエラーハンドリング不足」というタイトルで、以下の内容を含めています:

  • 概要: RegularEventOrganizer.create のエラーハンドリング不足の説明
  • 再現手順
  • 期待される振る舞い
  • 関連Issue欄にPR #9715とコメントURLを記載
  • ラベル: バグ
  • 担当者: yokomaru さん

ご確認よろしくお願いいたします。


🧠 Learnings used
Learnt from: yokomaru
Repo: fjordllc/bootcamp PR: 9505
File: test/fixtures/regular_events.yml:253-262
Timestamp: 2026-01-15T06:30:59.321Z
Learning: fjordllc/bootcamp の RegularEvent モデルにおいて、`user` フィールドは「作成者」を意味し、主催者は別途 Organizer モデルで管理されている。通常は作成者 = 主催者のパターンが多いが、システム上は分離されている設計である。

Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 8977
File: app/controllers/reports_controller.rb:63-63
Timestamp: 2025-07-23T20:31:13.856Z
Learning: fjordllc/bootcampプロジェクトの`app/controllers/reports_controller.rb`において、`create`と`update`アクションは両方とも`report.save_uniquely`を使用し、同じ`:report_save`イベントと`'report.save'`イベントを発行する。これは両方とも本質的に「レポートの保存」操作であり、作成と更新を区別する必要がないためである。

Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-23T21:11:21.826Z
Learning: fjordllc/bootcampプロジェクトの`app/models/inquiry_notifier.rb`において、`NOTIFICATION_SENDER_NAME`で指定される管理者ユーザーは必ず存在することがシステムの前提条件として保証されているため、senderがnilになることは想定されておらず、エラーハンドリングは不要である。

Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: db/fixtures/pair_works.yml:19-20
Timestamp: 2026-01-15T03:21:32.929Z
Learning: fjordllc/bootcampの db/fixtures/pair_works.yml において、pair_work1とpair_work2は特定の状態(解決済み・募集中)の動作確認用フィクスチャであり、意図的に過去の静的な日付(例: Time.zone.parse('2025-01-01 00:00:00'))を使用している。これはテストの再現性を保証するための設計であり、問題ではない。

Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`はUnfinishedDataDestroyer(未チェックProduct・WIP Report削除、career_pathリセット)とTimesChannelDestroyer(Discord分報チャンネル削除)による重要なデータクリーンアップ処理を実行するため、退会のトリガーが何であろうと(admin、hibernation、user)必ず実行する必要がある。

Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Learnt from: matuaya
Repo: fjordllc/bootcamp PR: 9108
File: app/models/after_user_retirement.rb:0-0
Timestamp: 2025-09-01T22:31:57.345Z
Learning: fjordllc/bootcampプロジェクトにおいて、`Newspaper.publish(:retirement_create, { user: user })`は通知処理ではなく、UnfinishedDataDestroyerやTimesChannelDestroyer等による重要なデータクリーンアップ処理を実行するため、管理者による退会(triggered_by: 'admin')の場合でも必ず実行する必要がある。

Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/controllers/pair_works_controller.rb:10-18
Timestamp: 2026-01-08T21:12:18.350Z
Learning: In fjordllc/bootcamp, when using ActiveRecord.order to specify ascending order, omit the explicit :asc and rely on Rails' default ASC behavior. Prefer .order(:published_at) over .order(published_at: :asc). If you need a non-default order (e.g., DESC), specify it explicitly. This guideline applies to Ruby/Rails controller and model files, especially in app/controllers and similar ActiveRecord usage sites.

Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/helpers/pair_work_helper.rb:31-33
Timestamp: 2026-01-15T03:20:24.643Z
Learning: In this Ruby project, prefer Numeric#hours (plural) for adding time durations. Use the plural hours method when converting integers to durations (e.g., hour_count.hours). Apply this consistently across the codebase to ensure uniform time calculations and Rails-style duration handling.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ありがとうございます!問題ありませんでした。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@yokomaru さん、どういたしまして!今後の対応、よろしくお願いいたします。


🧠 Learnings used
Learnt from: yokomaru
Repo: fjordllc/bootcamp PR: 9505
File: test/fixtures/regular_events.yml:253-262
Timestamp: 2026-01-15T06:30:59.321Z
Learning: fjordllc/bootcamp の RegularEvent モデルにおいて、`user` フィールドは「作成者」を意味し、主催者は別途 Organizer モデルで管理されている。通常は作成者 = 主催者のパターンが多いが、システム上は分離されている設計である。

Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。

Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/controllers/pair_works_controller.rb:10-18
Timestamp: 2026-01-08T21:12:18.350Z
Learning: In fjordllc/bootcamp, when using ActiveRecord.order to specify ascending order, omit the explicit :asc and rely on Rails' default ASC behavior. Prefer .order(:published_at) over .order(published_at: :asc). If you need a non-default order (e.g., DESC), specify it explicitly. This guideline applies to Ruby/Rails controller and model files, especially in app/controllers and similar ActiveRecord usage sites.

Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/helpers/pair_work_helper.rb:31-33
Timestamp: 2026-01-15T03:20:24.643Z
Learning: In this Ruby project, prefer Numeric#hours (plural) for adding time durations. Use the plural hours method when converting integers to durations (e.g., hour_count.hours). Apply this consistently across the codebase to ensure uniform time calculations and Rails-style duration handling.

If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

Copy link
Copy Markdown
Contributor

@torinoko torinoko Mar 3, 2026

Choose a reason for hiding this comment

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

[NITS]
@yokomaru も触れてた気がするけど、修正時にここの記述も直してよいかもしれませんね。
どっちでもいいけどその方がやっぱり Ruby on Rails っぽいよね。

Suggested change
RegularEventOrganizer.create(user_id: current_user.id, regular_event_id: @regular_event.id)
RegularEventOrganizer.create(user: current_user, regular_event: @regular_event)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@yokomaru yokomaru force-pushed the chore/prepare-for-rename-of-organizers-table branch from f5ee552 to 6a05094 Compare March 3, 2026 08:30
@torinoko torinoko requested review from ryufuta and torinoko March 3, 2026 08:40
@yokomaru yokomaru changed the title Organizerモデルの名称RegularEventOrganizerに変更した OrganizerをRegularEventOrganizerにリネームした Mar 3, 2026
Copy link
Copy Markdown
Contributor

@torinoko torinoko left a comment

Choose a reason for hiding this comment

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

@yokomaru
ヨサソウ! "(\( ⁰⊖⁰)/)"

if @regular_event.save
update_published_at
Organizer.create(user_id: current_user.id, regular_event_id: @regular_event.id)
RegularEventOrganizer.create(user_id: current_user.id, regular_event_id: @regular_event.id)
Copy link
Copy Markdown
Contributor

@torinoko torinoko Mar 3, 2026

Choose a reason for hiding this comment

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

[NITS]
@yokomaru も触れてた気がするけど、修正時にここの記述も直してよいかもしれませんね。
どっちでもいいけどその方がやっぱり Ruby on Rails っぽいよね。

Suggested change
RegularEventOrganizer.create(user_id: current_user.id, regular_event_id: @regular_event.id)
RegularEventOrganizer.create(user: current_user, regular_event: @regular_event)

scope :holding, -> { where(finished: false) }
scope :participated_by, ->(user) { where(id: all.filter { |e| e.participated_by?(user) }.map(&:id)) }
scope :organizer_event, ->(user) { joins(:organizers).where(organizers: { user_id: user.id }) }
scope :organizer_event, ->(user) { joins(:regular_event_organizers).where(regular_event_organizers: { user_id: user.id }) }
Copy link
Copy Markdown
Contributor

@torinoko torinoko Mar 3, 2026

Choose a reason for hiding this comment

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

[NITS]
ここもかな?(同上)

Suggested change
scope :organizer_event, ->(user) { joins(:regular_event_organizers).where(regular_event_organizers: { user_id: user.id }) }
scope :organizer_event, ->(user) { joins(:regular_event_organizers).where(regular_event_organizers: { user: user }) }

end

def organizers
# TODO: order内のorganizersをテーブル名を変えた時にregular_event_organizersに変更する
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[LGTM]
TODO 書いているのよいですね ✨

@yokomaru
Copy link
Copy Markdown
Contributor Author

yokomaru commented Mar 4, 2026

モデルとテーブルは一気に更新することになったので一度こちらはクローズします🙇
@torinoko さんにレビューいただいた内容は以下PRにて対応します。

@yokomaru yokomaru closed this Mar 4, 2026
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.

2 participants