Rails 在多个表上acts_as_taggable_
我刚刚安装了 acts_as_taggable_on 插件,我正在尝试执行
@products = Product.find(:all, :include => [:points, :tags], :conditions => '...', :tags => ; 'tag1, tag2')
如您所见,我想将 find() 方法与其他 2 个模型(产品、点、标签)一起使用。我想在 :condition => 中使用所有 3 个模型{} 属性。
有可能吗。我应该怎么办?
I just installed acts_as_taggable_on plugin and I'm trying to do
@products = Product.find(:all, :include => [:points, :tags], :conditions => '...', :tags => 'tag1, tag2')
As you can see I would like to use find() method with 2 other models (Product,Point,Tag). I would like to use all 3 models in a :condition => {} attribute.
Is it posible. What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不直接合并结果呢?
Why don't you just merge the results?
我认为您问的是如何在条件哈希中使用多个模型进行查找。像这样的东西应该有效。
I think you're asking how to use multiple models in a conditions hash for find. Something like this should work.