Not*_*ere 5 join ruby-on-rails include
我有一个应用程序,我在当前用户显示帖子(posts.current_user).我想通过comment.date排序来显示最近评论过的帖子.它似乎不想这样做...我一直在:
PG :: UndefinedTable:错误:缺少表"注释"的FROM子句条目
我的控制器
def_index
@posts = current_user.posts.includes(:comment).order("comment.date ASC").includes(:image)
end
Run Code Online (Sandbox Code Playgroud)
我试过加入并包括一个我似乎无法解决这个问题.谢谢.
apn*_*ing 16
尝试:
@posts = current_user.posts.joins(:comment).order("comments.date ASC").includes(:image)
Run Code Online (Sandbox Code Playgroud)
说明:
| 归档时间: |
|
| 查看次数: |
4913 次 |
| 最近记录: |