Skip to content

Conversation

@mtokna7
Copy link
Owner

@mtokna7 mtokna7 commented Jun 23, 2023

【選択した事業課題】
2. 直近一年間で、2回以上もくもく会に参加してくれた人は利用者全体の1%のみ。もくもく会で気の合う仲間を見つけられなかったのではないか?

スクリーンショット 2023-06-23 14 52 10

Copy link

@tarakish tarakish left a comment

Choose a reason for hiding this comment

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

ご提出ありがとうございます。
全体的に良く実装できていて概ね問題ないと思います!
細かいですが修正点について2点コメントしましたのでご修正と再提出をお願いします!

Comment on lines +3 to +11
def create
current_user.follow(params[:user_id])
redirect_back fallback_location: users_path
end

def destroy
current_user.unfollow(params[:user_id])
redirect_back fallback_location: users_path
end

Choose a reason for hiding this comment

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

モデルにロジックを寄せられていて良いですね👍

<%= attendee.name %>
</div>
<%= link_to attendee.name, user_path(attendee) %>
</div>

Choose a reason for hiding this comment

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

細かいですがインデントがズレているので修正しましょう!

Comment on lines +2 to +5
belongs_to :follower, class_name: "User"
belongs_to :followed, class_name: "User"
validates :follower_id, presence: true
validates :followed_id, presence: true

Choose a reason for hiding this comment

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

念のためfollower_idfollowed_idで複合ユニーク制約をつけておくと良さそうです。

@mtokna7
Copy link
Owner Author

mtokna7 commented Jun 23, 2023

ご指摘いただきありがとうございます。以下2点修正いたしました。ご確認よろしくお願いいたします。
・app/views/events/_attendee.html.erbのインデントの修正
・app/views/models/following.rbにユニーク制約を追加

課題内容に関係ないかもしれませんが、ログインしていない状態でユーザー詳細画面にアクセスした場合にNoMethodErrorが表示されるのが気になったため、app/views/users/show.html.erbを修正しました。

@murata0705
Copy link

良いと思います 👍🏻
次の課題に進みましょう。

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.

4 participants