has_manyのおもちゃを持っている人がいるとしましょう。それから私はhas_many色のおもちゃを持っています。Person#showメソッドで実行しようとしているのは、さまざまな色を含むおもちゃをフィルタリングすることです。
class Person < ActiveRecord::Base
 attr_accessible :name
 has_many :toys
end
class Toy < ActiveRecord::Base
 attr_accessible :size
 belongs_to :person
 has_many :colors
end
class Color < ActiveRecord::Base
 attr_accessible :color
 belongs_to :toy
end
次に、PersonControllerで、おもちゃをさまざまな色でフィルタリングします。
class PersonController < ApplicationController
 def show
  @person = Person.find(params[:id])
  # Now I want to filter by toy colors that might be red or blue or purple or etc...
  # So when in my view I do @person.toys I know they only contain the filtered colors
  @person.toys.categories
 end
end
そして、助けや提案をいただければ幸いです。まだ積極的にRailsを学んでいます。