I'm using Rails 2.3.2, on Ubuntu 8.10. Ok, here is a capture of the "params" sent to create a record, with the nested params: # URL: http://localhost:3000/compras/create # Compra params compra[fecha] 2009-06-04 compra[proveedor_id] 1 compra[condicion_de_pago] 15 dias compra[fecha_de_pago] 2009-06-18
# First nested model, DetalleDeCompra params compra[detalle_de_compras_attributes][0][id] compra[detalle_de_compras_attributes][0][cantidad] 10 compra[detalle_de_compras_attributes][0][precio_unitario] 123 # Second nested model, Lote params compra[detalle_de_compras_attributes][0][lote_attributes][cantidad] 10 compra[detalle_de_compras_attributes][0][lote_attributes] [estado_del_lote_id] 2 compra[detalle_de_compras_attributes][0][lote_attributes][producto_id] 5 Then the params to delete that DetalleDeCompra instance that triggers the problem: # URL: http://localhost:3000/compras/update/3 compra[fecha] 2009-06-04 compra[proveedor_id] 1 compra[condicion_de_pago] 15 dias compra[fecha_de_pago] 2009-06-18 compra[detalle_de_compras_attributes][0][id] 8 compra[detalle_de_compras_attributes][0][cantidad] 10 compra[detalle_de_compras_attributes][0][precio_unitario] 123 compra[detalle_de_compras_attributes][0][_delete] true compra[detalle_de_compras_attributes][0][lote_attributes][cantidad] 10 compra[detalle_de_compras_attributes][0][lote_attributes] [estado_del_lote_id] 2 compra[detalle_de_compras_attributes][0][lote_attributes][producto_id] 5 And the code, is the same code that all controllers have in the Update action: @data = Compra.find(params[:id]) @data.update_attributes(params[compra]) @data.save Best regards. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
