| ... | ... | @@ -150,6 +150,42 @@ class SimulationsController < ApplicationController |
|
|
|
end
|
|
|
|
```
|
|
|
|
|
|
|
|
3. To ensure that update_jobs is called prior to the `@simulation` object being created, get rid of the `before_action :set_simulation` and call this explicitly in each controller action:
|
|
|
|
|
|
|
|
```diff
|
|
|
|
class SimulationsController < ApplicationController
|
|
|
|
- before_action :set_simulation, only: [:show, :edit, :update, :destroy, :submit, :copy]
|
|
|
|
before_action :update_jobs, only: [:index, :show]
|
|
|
|
|
|
|
|
...
|
|
|
|
def show
|
|
|
|
+ set_simulation
|
|
|
|
end
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
def edit
|
|
|
|
+ set_simulation
|
|
|
|
end
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
def update
|
|
|
|
+ set_simulation
|
|
|
|
respond_to do |format|
|
|
|
|
...
|
|
|
|
def destroy
|
|
|
|
+ set_simulation
|
|
|
|
respond_to do |format|
|
|
|
|
...
|
|
|
|
def submit
|
|
|
|
+ set_simulation
|
|
|
|
respond_to do |format|
|
|
|
|
...
|
|
|
|
def copy
|
|
|
|
+ set_simulation
|
|
|
|
@simulation = @simulation.copy
|
|
|
|
```
|
|
|
|
|
|
|
|
## Test Changes
|
|
|
|
|
| ... | ... | |