Class: ForemanDatacenter::PowerOutletTemplatesController
- Inherits:
-
ApplicationController
show all
- Includes:
- Controller::Parameters::PowerOutletTemplate
- Defined in:
- app/controllers/foreman_datacenter/power_outlet_templates_controller.rb
Instance Method Summary
collapse
#action_permission, #controller_permission, #find_resource, #not_found, #resource_class, #resource_class_for, #resource_finder, #resource_name, #resource_scope, #scope_for
Instance Method Details
#create ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/foreman_datacenter/power_outlet_templates_controller.rb', line 13
def create
@power_outlet_template = PowerOutletTemplate.new(power_outlet_template_params.merge(device_type_id: params[:device_type_id]))
if @power_outlet_template.save
process_success success_redirect: device_type_url(@power_outlet_template.device_type_id)
else
process_error object: @power_outlet_template
end
end
|
#destroy ⇒ Object
23
24
25
26
27
28
29
|
# File 'app/controllers/foreman_datacenter/power_outlet_templates_controller.rb', line 23
def destroy
if @power_outlet_template.destroy
process_success success_redirect: device_type_url(params[:device_type_id])
else
process_error object: @power_outlet_template
end
end
|
#new ⇒ Object
7
8
9
10
11
|
# File 'app/controllers/foreman_datacenter/power_outlet_templates_controller.rb', line 7
def new
@power_outlet_template = PowerOutletTemplate.new(
device_type: DeviceType.find(params[:device_type_id])
)
end
|