I am struggling with an ActiveRecord query in Rails 3.1.1.
I have 2 models, Product and Category, with a has_and_belongs_to_many from Product to Category (a Product
results = Product.joins(:category_products) [1,5,8].each do |category| results = results.where('category_products.category_id' => category) end