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
|
# 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
process_success(success_redirect: device_url(id: @management_device.device))
else
process_error object: @management_device
end
end
|
#destroy ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 33
def destroy
if @management_device.destroy
process_success(success_redirect: device_url(id: @management_device.device))
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
25
26
27
28
29
30
31
|
# File 'app/controllers/foreman_datacenter/management_devices_controller.rb', line 25
def update
if @management_device.update(management_device_params)
process_success(success_redirect: device_url(id: @management_device.device))
else
process_error object: @management_device
end
end
|