Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

families_controllerでActiveRecordを活用できそうな箇所の修正 #188

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

siroemk
Copy link
Owner

@siroemk siroemk commented Nov 15, 2023

Issue

概要

コードレビューで以下のようにアドバイスをいただいた。

@users = User.where(family_id: current_user.family_id).where.not(id: current_user.id).order(created_at: :asc)

@family.users.where.not(id: current_user.id).order(created_at: :asc) と書けますね
User クラスの scope にできると尚良しです

where.not(id: current_user.id)の部分をUserクラスにscopeにした。

@siroemk siroemk merged commit 1c8bb1b into main Nov 15, 2023
2 checks passed
@siroemk siroemk deleted the code-review-families-comtroller branch November 15, 2023 03:39
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.

1 participant