I want to change the status
of a Job
-record, after the status
of any of its children (Jobdetails
) is set to true.
Basically the code should be something like:
if every Job.jobdetail.status == true
Job.status = true
end
the problem is, that i dont know how to check for any. Of course i know the where
-statement in rails but I am not sure how to express the "any" without an each iteration, which wont work in this case i guess. Everytime after I update the Jobdetails
, I want to check if the other Jobdetails
are "done" too. Imagine the function like a progressbar. If every sub-job is done, change the status of the main-job to done. How do I achieve this?
thanks in regards.
Aucun commentaire:
Enregistrer un commentaire