मेरे पास एक उत्पाद मॉडल है जिसमें कई अनुभाग हैं, और एक सेक्शन कई उत्पादों से संबंधित हो सकता है।एकल टेबल विरासत से जुड़े एचएबीटीएम एसोसिएशन
अनुभाग मॉडल में फ़ीचर, मानक और विकल्प के उप-वर्ग हैं।
मेरे मॉडल हैं:
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
अपने उत्पादों नियंत्रक में मैं यह कर सकता:
@product.features.build
@product.standards.build
@product.options.build
:
@product.sections.build
मैं कुछ इस तरह की तरह उपवर्गों को पाने के लिए सक्षम होना चाहते हैं
लेकिन यह केवल "अपरिभाषित विधि" सुविधाओं "आदि के साथ त्रुटियों में है।
कृपया कोई मुझे बता सकता है कि यह कैसे करें?