Class: ForemanDatacenter::ManagementDevicesController
- Inherits:
-
ApplicationController
show all
- Includes:
- Controller::Parameters::ManagementDevice
- Defined in:
- app/controllers/foreman_datacenter/management_devices_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
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 15
def create
@management_device = ManagementDevice.new(management_device_params.merge(device_id: params[:device_id]))
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
|
#destroy ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 35
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
|
#edit ⇒ Object
12
13
|
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 12
def edit
end
|
#new ⇒ Object
7
8
9
10
|
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 7
def new
device = Device.find(params[:device_id])
@management_device = ManagementDevice.new(device: device)
end
|
#update ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 26
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
|