Rails 3 模型关联。限制所选数据的数量
我有一个模范用户、一个提要和一条评论。用户有很多提要和评论,提要属于用户并有很多评论,最后评论属于用户和提要。
不,当我显示某个用户的提要时,它会选择每个提要迄今为止所做的所有评论。我希望它只选择过去 1 分钟内发表的评论,如果没有,我想显示最近的 2 条评论...我该怎么做???
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, and if none were, i want to show the 2 most recent ones... how can i do that???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论