Ruby on Rails Wednesday, December 4, 2019

The problem I'm having is that only matching rows from ItemProperty that were present when the item was originally created appear in the form I also tried iterating through @item.item_properties and if there was no matching entry in @item.item_item_properties then I would build for that field/row but that didn't work either

  # GET /items/1/edit
  def edit
        ItemProperty.where("item_type_id=?", params[:item_type_id]).each do |ip|
            @item.item_item_properties.build(item_property_id: ip.id)
        end
  end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/494af831-0db9-4874-a0de-254c119298e1%40googlegroups.com.

No comments:

Post a Comment