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
Post a Comment