Class: SystemTester::ScenariosController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- SystemTester::ScenariosController
- Defined in:
- app/controllers/system_tester/scenarios_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
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() else render json: { errors: scenario.errors }, status: :unprocessable_entity end end |
#destroy ⇒ Object
32 33 34 35 |
# File 'app/controllers/system_tester/scenarios_controller.rb', line 32 def destroy Scenario.find(params[:id]).destroy! render json: {} end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/system_tester/scenarios_controller.rb', line 5 def index render json: Scenario.all.to_json() end |
#show ⇒ Object
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() end |
#update ⇒ Object
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() else render json: { errors: scenario.errors }, status: :unprocessable_entity end end |