Class: SystemTester::ScenariosController

Inherits:
ApplicationController show all
Defined in:
app/controllers/system_tester/scenarios_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
# File 'app/controllers/system_tester/scenarios_controller.rb', line 14

def create
  scenario = Scenario.new(scenario_params)
  if scenario.save
    render json: scenario.to_json(scenario_json_options)
  else
    render json: { errors: scenario.errors }, status: :unprocessable_entity
  end
end

#destroyObject



32
33
34
35
# File 'app/controllers/system_tester/scenarios_controller.rb', line 32

def destroy
  Scenario.find(params[:id]).destroy!
  render json: {}
end

#indexObject



5
6
7
# File 'app/controllers/system_tester/scenarios_controller.rb', line 5

def index
  render json: Scenario.all.to_json(scenario_json_options)
end

#showObject



9
10
11
12
# File 'app/controllers/system_tester/scenarios_controller.rb', line 9

def show
  scenario = Scenario.find(params[:id])
  render json: scenario.to_json(scenario_json_options)
end

#updateObject



23
24
25
26
27
28
29
30
# File 'app/controllers/system_tester/scenarios_controller.rb', line 23

def update
  scenario = Scenario.find(params[:id])
  if scenario.update(scenario_params)
    render json: scenario.to_json(scenario_json_options)
  else
    render json: { errors: scenario.errors }, status: :unprocessable_entity
  end
end