我想要做的是創建一個只顯示當前用戶的帖子,興趣和專輯而不是網站上的所有興趣和專輯的索引頁面。要做到這一點,我使用current_user
方法在PostsController
嘗試,但我不斷收到一個沒有方法錯誤:如何使對象可以在rails中查看當前用戶
def index
@posts = current_user.Post.all
@albums = current_user.Album.all
@interests = current_user.Interest.all
end
這個案例很重要.... –