-
Notifications
You must be signed in to change notification settings - Fork 249
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
指摘部分を修正しました。 #7
base: develop
Are you sure you want to change the base?
指摘部分を修正しました。 #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あと一歩!コメントしました!
|
||
# フォローを外すときの処理 | ||
def unfollow(user_id) | ||
followers.find_by(followed_id: user_id).destroy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ollowers.find_by(followed_id: user_id)
の結果がnilの場合、 nil.destroy でエラーになるので、早期 return や ぼっち演算子で対応お願いします!
@@ -0,0 +1,6 @@ | |||
FactoryBot.define do | |||
factory :relationship do | |||
follower_id { 1 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1や2 といった数字はマジックナンバーになるため、修正しましょう!
使っていないファイルは削除し、共通化してbefore_actionしました。
[](url)