基于关联的 Rails 顺序
我有一个问题和一个解决方案模型。问题有很多解决方案,解决方案属于问题。
我需要得到最近解决的问题,这意味着,得到最后的X个解决方案并得到它的问题。我很确定有一种方法可以使用named_scopes 来做到这一点,但我无法弄清楚。
非常感谢任何帮助:-)
谢谢,
尼古拉斯·霍克一世。
I have a Problem and a Solution model. Problem has many solutions and Solution belongs to problem.
I need to get the recently solved problem, that means, get the last X solutions and get it's problem. I'm pretty sure there's a way to do this with named_scopes but I can't figure it out.
Any help is really appreciated :-)
Thanks,
Nicolás Hock I.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我实际上让named_scope工作了:
无论如何谢谢@Jacob:)
I actually got the named_scope working:
Thanks anyway @Jacob :)
我认为这应该有效:
I think this should work: