我在创建嵌套关联时遇到了一些麻烦,我无法发现正在发生的事情:
class Package < ActiveRecord::Base
has_many :selections, :class_name => "PackageSelection"
has_many :channels, :through => :selections
has_many :categories, :through => :channels, :source => ?????
end
class Channel < ActiveRecord::Base
belongs_to :category
has_many :package_selections
has_many :packages, :through => :package_selections
end
class Category < ActiveRecord::Base
has_many :channels
end
我想弄清楚如何建立与类别的关联。有什么建议吗?