Class: ForemanDatacenter::ConsolePortTemplatesController

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

def create
  @console_port_template = ConsolePortTemplate.new(console_port_template_params)

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

#destroyObject



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

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

#newObject



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

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