I'm trying to exit from a loop if model changes.
having the status
attribute:
@model.status = 'started'
(0..100).each do |i|
return if status == 'stopped'
sleep(10)
# my taks...
end
the problem is, once is started
changes in the model are not reflected within the loop, any ideas?
You would need to query the status inside the loop so that it gets an updated status.