| ... | ... | @@ -125,6 +125,32 @@ $ scl enable git19 rh-ruby22 -- bin/bundle install --path=vendor/bundle |
|
|
|
$ scl enable git19 rh-ruby22 -- bin/rake db:setup RAILS_ENV=development
|
|
|
|
```
|
|
|
|
|
|
|
|
#### 7. Explicitly update status of jobs on each request
|
|
|
|
|
|
|
|
In v1.0.0 of osc_machete_rails we tried to auto-update the active jobs of all Statusable subclass instances. This hasn't worked reliably. To undo this change:
|
|
|
|
|
|
|
|
1. Add `config/initializers/osc_machete_rails.rb`
|
|
|
|
|
|
|
|
```diff
|
|
|
|
+OscMacheteRails.update_status_of_all_active_jobs_on_each_request = false
|
|
|
|
```
|
|
|
|
|
|
|
|
2. For each simulations controller add a before action and a method to update the active jobs:
|
|
|
|
|
|
|
|
```diff
|
|
|
|
class SimulationsController < ApplicationController
|
|
|
|
before_action :set_simulation, only: [:show, :edit, :update, :destroy, :submit, :copy]
|
|
|
|
+ before_action :update_jobs, only: [:index, :show]
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
+ def update_jobs
|
|
|
|
+ SimulationJob.active.to_a.each(&:update_status!)
|
|
|
|
+ end
|
|
|
|
end
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Test Changes
|
|
|
|
|
|
|
|
Test to make sure everything's working properly.
|
| ... | ... | |