On 20 April 2016 at 02:54, Elton Santos <elton.melo.santos@gmail.com> wrote:
> It is almost finishing! I believe. Look:
>
>> Processing by RefinancingsController#new as HTML
>> Parameters: {"utf8"=>"✓", "search_employee_by_cpf"=>"11111111111",
>> "authorization"=>{"contract_number"=>["11", "33"], "value_solve"=>["43343",
>> "", "45454", ""]}, "commit"=>"Reserve"}
>> SQL (91.9ms) UPDATE "authorizations" SET "value_solve" = '43343',
>> "situation" = 2 WHERE "authorizations"."contract_number" = ?
>> [["contract_number", "11"]]
>> SQL (87.0ms) UPDATE "authorizations" SET "value_solve" = '',
>> "situation" = 2 WHERE "authorizations"."contract_number" = ?
>> [["contract_number", "33"]]
>
>
> The problem is because take just first element, this is the code:
>
>> auth_params = params[:authorization]
>> auth_params[:contract_number].zip(auth_params[:value_solve]).each do
>> |contract_number, value_solve|
>> Authorization.where(contract_number:
>> contract_number).update_all(value_solve: value_solve, situation: 2)
>> end
>
If you look back at my early posts in this thread you will see I did
point out that your original code would not work with an array.
Apparently you ignored that.
Colin
--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsS2NwBXK4%3DOXV5qCRgiUA7kUqmGOoQ1nkAER3%3DnK_Npw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment