Class: ForemanDatacenter::PowerPortTemplatesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/foreman_datacenter/power_port_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_port_templates_controller.rb', line 11

def create
  @power_port_template = PowerPortTemplate.new(power_port_template_params)

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

#destroyObject



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

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

#newObject



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

def new
  @power_port_template = PowerPortTemplate.new(
    device_type: DeviceType.find(params[:device_type_id]),
  )
end