Populate multiple select elements from the database

I have this schema and I just want to create a form to create/edit products

  schema "products" do
    has_many :product_components, XYZ.Inventory.ProductComponent

the form should be:

  1. dynamic so that I can add and remove items
  2. have a select element populated with the items in the “product_components” table