开发者

Rails 3 model associations. Limit the number of data selected

开发者 https://www.devze.com 2023-01-11 12:00 出处:网络
I have a model user, a feed, and a comment. user has many feeds and comments, feeds belong to user and have many comments and finally comments belong to user and feed.

I have a model user, a feed, and a comment. user has many feeds and comments, feeds belong to user and have many comments and finally comments belong to user and feed.

No when i show feeds for a certain user, it selects all the comments made till date for every feed. I want it to select only those comments that were made in the last 1 min, 开发者_StackOverflow社区and if none were, i want to show the 2 most recent ones... how can i do that???

0

精彩评论

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