我有以下 Rails 模型:
class Entry < ActiveRecord::Base
has_and_belongs_to_many :tags, :uniq => true
end
和
class Tag < ActiveRecord::Base
has_and_belongs_to_many :entries, :uniq => true
end
很明显,一个“条目”可以有许多与之关联的“标签”。
使用插件 Meta_Search 我希望能够执行搜索(通过表单),返回具有多个关联标签的“条目”。
我尝试了几种技术,包括(命名的)范围和方法,但我无法实现这一点。
有谁知道如何执行此操作?
谢谢。