I am trying to create a form where the user once selects a product_id from select, he will be displayed all the options and their values from product_options.
I am unable to figure out how to make the form display dynamically based on selecting product_id which is in the form itself.
I have the following schemas :
Product :
create table(:products) do add :name, :string add :description, :string
Options :
create table(:options) do add :description, :string [eg : size,weight,color etc.,]
Product_options :
create table(:product_options) do add :values, {:array, :string}, default: [] ( contains all possible values for one product and option) add :product_id, references(:products, on_delete: :nothing) add :option_id, references(:options, on_delete: :nothing)
I want to create a inventory where options is a map of values for each option that the product has through product_options.
The schema looks like this :
create table(:product_inventory) do add :options, :map add :product_id, references(:products, on_delete: :nothing)