ruby on rails - Scoping behavior around find_each -


I have a lot of records in a table that I'm trying to change to use find_each. Is that if I have an opportunity with which I am using a find_each and I think that for some records I am changing that value, will those affected records also be found? For example, if I do something like this:

  User.where (classification: zero) .find_each do | U | If u.age & gt; 21 u.update! (Classification: "Accepted") User.where (Classification: Zero). Where (age> 21) .each do | Others | Other users will know that I was updated even while processing the previous user, still can be processed in search_elected on which scod has been changed on the value they were?  

I do not think it will end after the search_each list has been updated. It uses the primary key as sort and does not kill the ID again in subsequent loops.

Edit

Sorry - I think what you are asking now. Yes, it will affect all the classifications so that they can remain zero because no one will return an external batch to another batch.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -