Auto generating forms

I have three tables: the products, type_products, properties and
value.

Typeproduct.rb

has_many :products
has_many :properties

Property.rb

belongs_to :type_product
has_many :values

Value.rb

belongs_to :property

Product.rb

belongs_to :type_product

What a best way to generate a form based on the conditions and values,
when client changing the type_products in the form

That’s four tables and they look cumbersome already and I haven’t even
seen the data yet. Before I give you an answer, drop two example rows
from each table and include the fields. I have a feeling that you are
not properly normalizing this and over-complicating things for yourself.