ロイの奮闘記録

PdMをやってるロイの日記です。人のつながりを増やしたいと思いながら、社会と奮闘しています

#92ログインしていない状態で、ユーザー詳細画面を見る

#92 1/18 ログインしていない状態で、ユーザー詳細画面を見る

 

※deviseの機能で、未ログイン状態をバンされている状態になっている

user_signed_in?で判断されている

https://qiita.com/tobita0000/items/866de191635e6d74e392

 

1.user_controller.rb

before_action :authenticate_user!, only: [:show,:message_room_id]

から、:showを省く

 

また、@currentUserEntry=Entry.where(user_id: current_user.id)

の箇所は、

if user_signed_in?で省く。

 

2.show.html.erb

current_userがある箇所は、

<% if user_signed_in? %>で、くくっておく

 

これで解決!