そのため、「学校」という名前のタグを持つすべての場所を見つけようとしています。Location has_many Tags および Tag has_many Locations :through モデル メソッドを介してアクセスされる結合テーブルを介して
class Location < ActiveRecord::Base
has_many :location_tags
has_many :locations, :through => :location_tags
end
class LocationTag < ActiveRecord::Base
belongs_to :location
belongs_to :tag
end
class Tag < ActiveRecord::Base
has_many :location_tags
has_many :locations, :through => :location_tags
end
これらが私のモデルです。includes
解決策には、joins
またはそれらの線に沿った何かが含まれることを私は知っています