经过很长时间的搜索,我最终提出了这个问题:如何在Rails 3.0中使用ActiveRecord::Relation进行OR条件查询?has_and_belongs_to_many :doctors我想要实现的是一个表单,在这个表单中,我可以执行搜索查询并返回ActiveRecord::Relation对象(这样我就可以将其与查询应该找到@practice.name匹配query_string OR where @practice.docto
我有一个product模型,它与tags有一个has_and_belongs_to_many关联。我正在尝试创建一个自定义查询,以排除带有特定标记的某些产品。使用下面的代码,如果从PG::UndefinedColumn: ERROR: column products.product_id does not exist...查询中删除.where.not(products_tagstsearch: {