Hello,
I'm trying to create a complex form with multiple models.
The problem is that the params hash is sent out of order to the controller, and the data is saved wrong in the database.
What I get is: Parameters: {"commit"=>"Cadastrar", "invoice"=>{"mode"=>"in", "total"=>"34", "items_attributes"=>[{"item"=>"3333333"}, {"quantity"=>"3333333", "item"=>"666666"}, {"price"=>"3333333", "quantity"=>"666666"}, {"price"=>"4666666"}], "company_id"=>"10"},....
But what I want is: Parameters: {"commit"=>"Cadastrar", "invoice"=>{"mode"=>"in", "total"=>"34", "items_attributes"=>[{"item"=>"3333333", "quantity"=>"3333333", price"=>"3333333"},{"item"=>"666666", "quantity"=>"666666","price"=>"666666"}], "company_id"=>"10"},...
Codes are:
Controller: http://pastie.org/334963 Models: http://pastie.org/334965 Views: http://pastie.org/334967
Does anyone know my error? Any help will be thankfull.
David Sousa