Class: SystemTester::StepsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
# File 'app/controllers/system_tester/steps_controller.rb', line 17

def create
  step = Step.new(step_params)
  if step.save
    render json: step.to_json(step_json_options)
  else
    render json: { errors: step.errors }, status: :unprocessable_entity
  end
end

#destroyObject



35
36
37
38
# File 'app/controllers/system_tester/steps_controller.rb', line 35

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

#indexObject



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

def index
  render json: Step.all.to_json(step_json_options)
end

#newObject



13
14
15
# File 'app/controllers/system_tester/steps_controller.rb', line 13

def new
  render json: Step.new(step_params).to_json(step_json_options)
end

#showObject



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

def show
  render json: Step.find(params[:id]).to_json(step_json_options)
end

#updateObject



26
27
28
29
30
31
32
33
# File 'app/controllers/system_tester/steps_controller.rb', line 26

def update
  step = Step.find(params[:id])
  if step.update(step_params)
    render json: step.to_json(step_json_options)
  else
    render json: { errors: step.errors }, status: :unprocessable_entity
  end
end