Ruby on Rails Monday, April 18, 2016


On 19 Apr 2016 3:16 a.m., "Elton Santos" <elton.melo.santos@gmail.com> wrote:
>
> Authorization.where(id: params[:authorization][:contract_ids]).update_all(value_solve: params[:authorization][:value_solve], situation: 2)
>   
>
>
> This is the line with error, and this is log:
>
> Parameters: {"utf8"=>"✓", "search_employee_by_cpf"=>"111111111",  "authorization"=>{"contract_ids"=>["11", "33"], "value_solve"=>["34343", "", "5454"]}, "commit"=>"Reserve"}
>

Whenever you have a problem you don't understand, start by splitting the problem down into smaller parts, so the next thing is to split into two statements and check that the the first part before the update_all gives the correct record set.

authorisations = Authorisations.where(..)
And inspect the result.

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/b1b62337-bda4-4362-b359-de4d56e50c0c%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

--
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%3D0gLvu8pw7cMA_--tSWYDBjaN%2B0qvR_C8xNCZUYrMACVQkMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment