Class: ForemanDatacenter::DeviceBaysController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanDatacenter::DeviceBaysController
- Defined in:
- app/controllers/foreman_datacenter/device_bays_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #depopulate ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #new ⇒ Object
- #populate ⇒ Object
- #populate_new ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 13 def create @device_bay = DeviceBay.new(device_bay_params) if @device_bay.save redirect_to device_url(@device_bay.device), notice: 'New device bay was successfully created' else process_error object: @device_bay end end |
#depopulate ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 55 def depopulate if @device_bay.update(installed_device_id: nil) redirect_to device_url(@device_bay.device), notice: 'Device bay was successfully depopulated' else process_error object: @device_bay end end |
#destroy ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 33 def destroy if @device_bay.destroy redirect_to device_url(@device_bay.device), notice: 'Device bay was successfully destroyed' else process_error object: @device_bay end end |
#edit ⇒ Object
10 11 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 10 def edit end |
#new ⇒ Object
6 7 8 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 6 def new @device_bay = DeviceBay.new(device: Device.find(params[:device_id])) end |
#populate ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 45 def populate device_id = params[:device_bay][:installed_device_id] if @device_bay.update(installed_device_id: device_id) redirect_to device_url(@device_bay.device), notice: 'Device bay was successfully populated' else process_error object: @device_bay end end |
#populate_new ⇒ Object
42 43 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 42 def populate_new end |
#update ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/controllers/foreman_datacenter/device_bays_controller.rb', line 24 def update if @device_bay.update(device_bay_params) redirect_to device_url(@device_bay.device), notice: 'Device bay was successfully updated' else process_error object: @device_bay end end |