Conversation
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 :allでorganizersも対象になるため、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
📒 Files selected for processing (8)
app/controllers/regular_events_controller.rbapp/models/regular_event.rbapp/models/regular_event_organizer.rbapp/models/user.rbtest/models/organizer_test.rbtest/models/regular_event_organizers_test.rbtest/models/user_test.rbtest/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) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
git ls-files app/controllers/regular_events_controller.rb app/models/regular_event*.rbRepository: fjordllc/bootcamp
Length of output: 343
🏁 Script executed:
head -50 app/controllers/regular_events_controller.rbRepository: 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 -20Repository: fjordllc/bootcamp
Length of output: 298
🏁 Script executed:
find app/models -name "*regular_event*" -o -name "*organizer*" | head -20Repository: fjordllc/bootcamp
Length of output: 361
🏁 Script executed:
cat -n app/models/regular_event_organizer.rbRepository: fjordllc/bootcamp
Length of output: 516
🏁 Script executed:
cat -n app/models/regular_event.rb | head -80Repository: 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 2Repository: fjordllc/bootcamp
Length of output: 582
🏁 Script executed:
rg "\.create\(" app/controllers/regular_events_controller.rbRepository: fjordllc/bootcamp
Length of output: 158
🏁 Script executed:
rg "find_or_create_by" app/ --include="*.rb" | head -20Repository: fjordllc/bootcamp
Length of output: 502
🏁 Script executed:
rg "create!" app/controllers/ -A 1 -B 1 | head -30Repository: 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 -40Repository: fjordllc/bootcamp
Length of output: 43
🏁 Script executed:
rg "\.create\!" app/models/regular_event.rb -B 2 -A 2Repository: fjordllc/bootcamp
Length of output: 145
🏁 Script executed:
rg "create!" app/models/regular_event.rb -B 2 -A 2Repository: fjordllc/bootcamp
Length of output: 43
🏁 Script executed:
rg "transaction" app/controllers/regular_events_controller.rbRepository: 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 2Repository: fjordllc/bootcamp
Length of output: 999
🏁 Script executed:
rg "find_or_create_by" app/ -B 1 -A 1 | head -40Repository: 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 10Repository: fjordllc/bootcamp
Length of output: 865
🏁 Script executed:
rg "find_or_create_by" app/models/ -B 1 -A 3 | head -50Repository: fjordllc/bootcamp
Length of output: 818
🏁 Script executed:
rg "belongs_to :user" app/models/regular_event_organizer.rb -B 1 -A 5Repository: 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.
| 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.
There was a problem hiding this comment.
既存の定期イベントに自動で作成者を主催者を作成する機能のバグなので別Issueとして対応いたします。
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
このリポジトリに登録してあるバグレポートのフォーマットに沿って作成お願いします。
There was a problem hiding this comment.
🧩 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.
There was a problem hiding this comment.
ありがとうございます!問題ありませんでした。
There was a problem hiding this comment.
@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!
There was a problem hiding this comment.
[NITS]
@yokomaru も触れてた気がするけど、修正時にここの記述も直してよいかもしれませんね。
どっちでもいいけどその方がやっぱり Ruby on Rails っぽいよね。
| RegularEventOrganizer.create(user_id: current_user.id, regular_event_id: @regular_event.id) | |
| RegularEventOrganizer.create(user: current_user, regular_event: @regular_event) |
There was a problem hiding this comment.
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!
- Issue#9640
f5ee552 to
6a05094
Compare
| 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) |
There was a problem hiding this comment.
[NITS]
@yokomaru も触れてた気がするけど、修正時にここの記述も直してよいかもしれませんね。
どっちでもいいけどその方がやっぱり Ruby on Rails っぽいよね。
| 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 }) } |
There was a problem hiding this comment.
[NITS]
ここもかな?(同上)
| 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に変更する |
|
モデルとテーブルは一気に更新することになったので一度こちらはクローズします🙇 |

Issue
概要
RegularEventとUserの中間モデルのOrganizerをRegularEventOrganizersにリネームした変更確認方法
chore/prepare-for-rename-of-organizers-tableをローカルに取り込むSummary by CodeRabbit
リリースノート
Refactor
Tests