开发者

Rails3: If X belong_to Y, how do I display all X regardless of Y?

I am experimenting to create something similar to Twitter.

In my app, posts belong to users, and users has many posts.

Now, I 开发者_StackOverflow中文版know how to display posts of one particular user sorted by submission time.

But I am not sure how to display all posts of all users in one page sorted by submission time.

Any idea?


Post.order(:submission_time)


Something like the following?

def stream
  @post = Post.order("created_at DESC")
end

Or am I misunderstanding you?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜