【发布时间】:2013-01-03 01:05:10
【问题描述】:
用户
- has_many :communities
- has_many :posts
社区
- belongs_to :user
- has_many :posts
发帖
- belongs_to :user
- belongs_to :community
我想在 example.com/posts 上显示所有帖子记录
但它必须按用户表中的 Post owner User's 'last_signed_in' 列进行排序。
我试过了,但这会返回错误undefined method `users' 我该如何解决?
@orders = @community.posts.user.order("last_active_at ASC")
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3