Class: SystemTester::FeaturesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
# File 'app/controllers/system_tester/features_controller.rb', line 9

def create
  feature = Feature.new(feature_params)
  if feature.save
    render json: feature.to_json(feature_json_options)
  else
    render json: { errors: feature.errors }, status: :unprocessable_entity
  end
end

#destroyObject



27
28
29
30
# File 'app/controllers/system_tester/features_controller.rb', line 27

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

#indexObject



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

def index
  render json: Feature.all.to_json(feature_json_options)
end

#updateObject



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

def update
  feature = Feature.find(params[:id])
  if feature.update(feature_params)
    render json: feature.to_json(feature_json_options)
  else
    render json: { errors: feature.errors }, status: :unprocessable_entity
  end
end