Class: ForemanDatacenter::ManagementDevicesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 13

def create
  @management_device = ManagementDevice.new(management_device_params)

  if @management_device.save
    redirect_to device_url(@management_device.device),
                notice: 'New management device was successfully created'
  else
    process_error object: @management_device
  end
end

#destroyObject



33
34
35
36
37
38
39
40
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 33

def destroy
  if @management_device.destroy
    redirect_to device_url(@management_device.device),
                notice: 'Management device was successfully destroyed'
  else
    process_error object: @management_device
  end
end

#editObject



10
11
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 10

def edit
end

#newObject



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

def new
  device = Device.find(params[:device_id])
  @management_device = ManagementDevice.new(device: device)
end

#updateObject



24
25
26
27
28
29
30
31
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 24

def update
  if @management_device.update(management_device_params)
    redirect_to device_url(@management_device.device),
                notice: 'Management device was successfully updated'
  else
    process_error object: @management_device
  end
end