Class: ForemanDatacenter::PowerOutletTemplatesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_datacenter/power_outlet_templates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/foreman_datacenter/power_outlet_templates_controller.rb', line 11

def create
  @power_outlet_template = PowerOutletTemplate.new(power_outlet_template_params)

  if @power_outlet_template.save
    redirect_to device_type_url(@power_outlet_template.device_type),
                notice: 'New power outlet template was successfully created'
  else
    process_error object: @power_outlet_template
  end
end

#destroyObject



22
23
24
25
26
27
28
29
# File 'app/controllers/foreman_datacenter/power_outlet_templates_controller.rb', line 22

def destroy
  if @power_outlet_template.destroy
    redirect_to device_type_url(@power_outlet_template.device_type),
                notice: 'Power outlet template was successfully destroyed'
  else
    process_error object: @power_outlet_template
  end
end

#newObject



5
6
7
8
9
# File 'app/controllers/foreman_datacenter/power_outlet_templates_controller.rb', line 5

def new
  @power_outlet_template = PowerOutletTemplate.new(
    device_type: DeviceType.find(params[:device_type_id])
  )
end