私は多くのセクションを持つ製品モデルを持っており、セクションは多くの製品に属することができます。単一テーブル継承に関連付けられたHABTM関連
セクションモデルには、Feature、Standard、Optionのサブクラスがあります。
私のモデルは以下のとおりです。
@product.features.build
@product.standards.build
@product.options.build
:
@product.sections.build
が、私はこのような何かのようにサブクラスを取得できるようにしたい:私はこれを行うことができ、私の製品コントローラで
class Product < ActiveRecord::Base
has_and_belongs_to_many :categories
has_and_belongs_to_many :sections
end
class Section < ActiveRecord::Base
has_and_belongs_to_many :products
end
class Feature < Section
end
class Standard < Section
end
class Option < Section
end
しかし、 "未定義のメソッド 'の機能などではエラーになります。
どうすればいいですか?