I'm designing an application that has products and suppliers. Single product has_many suppliers and each supplier has unique supplier code for each product.
The form would facilitate something like 1. Select supplier from the list --> 2. Type the supplier code related to supplier in the text field
The supplier codes can be added dynamically.
#Product model class Product < ActiveRecord::Base has_many :supplier_codes has_many :suppliers, :through => :supplier_codes end
#Supplier_code model class SupplierCode < ActiveRecord::Base belongs_to :product belongs_to :suppliers end
#Supplier model class Supplier < ActiveRecord::Base has_many :supplier_codes has_many :products, :through => :supplier_codes end
The supplier_code table has these columns product_id supplier_id code
I'm stuck with developing controller and form. trying out many things but no success so far. Any help welcome.