次のモデル クラスがあります。
class OptionCategory < ActiveRecord::Base
attr_accessible :disabled, :list_index, :name
has_many :options
end
class Option < ActiveRecord::Base
attr_accessible :disabled, :name, :option_category_id
belongs_to :option_category
has_and_belongs_to_many :products
end
class Product < ActiveRecord::Base
attr_accessible :annual_fee, :bal_transfer_intro_apr_end, :bal_transfer_intro_apr_start, :balance_transfer_fee, :description, :image, :image_cache, :name, :pur_intro_apr_end, :pur_intro_apr_start, :sign_up_bonus, :sign_up_bonus_type, :url
mount_uploader :image, ImageUploader
has_and_belongs_to_many :options
end
私のコントローラーの 1 つで、オプション ID の配列を受け取りました。これらの ID に一致するオプションを持つ製品を照会したいと思います。Railsでこれを行う簡単な方法はありますか? ありがとう!