hi all
I have a product model that has many sections and a section can belong to many products.
The section model has subclasses as features, standardAccessories and OptionalAccessories in a STI. Each having field title, body, image url and (optionalAccessories) has price.
my models are
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
In my products controller i can do this
@product.sections.build
but i want to be able to get to the subclasses like something like this
@product.features.build
@product.standards.build
@product.options.build
BUT it just errors with "undefined method 'features' " etc
Please can anyone tell me how to do this ??
Thanks alot in advance rick