main
1class EnvironmentsController < ApplicationController
2 def index
3 @environments = Environment.where(id: params[:ids])
4 end
5
6 def show
7 @environment = Environment.find(params[:id])
8 end
9
10 def create
11 service = Service.find(params[:environment][:service_id])
12 @environment = service.environments.create!(environment_params)
13 end
14
15 def destroy
16 Environment.find(params[:id]).destroy
17 render json: {}
18 end
19
20 private
21
22 def environment_params
23 params.require(:environment).permit(:name)
24 end
25end