1
I have the following configuration in Rails:
Company
has_many :company_products
has_many :products, :through => :company_products
Product
has_many :company_products
has_many :companies, :through => :company_products
Productgroup
has_many :company_products
Companyproduct
belongs_to :company
belongs_to :product
belongs_to :product_group
I need to validate every time I create the Company or Product contains a CompanyProduct also.
How can I validate CompanyProduct by the Company or Product ?