edit action for nested form with has_many_through association

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

edit action for nested form with has_many_through association

fugee ohu
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/494af831-0db9-4874-a0de-254c119298e1%40googlegroups.com.