Class: ForemanDatacenter::RacksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanDatacenter::RacksController
- Defined in:
- app/controllers/foreman_datacenter/racks_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #rack_groups ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 26 def create @rack = ForemanDatacenter::Rack.new(rack_params) if @rack.save process_success object: @rack else process_error object: @rack end end |
#destroy ⇒ Object
44 45 46 47 48 49 50 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 44 def destroy if @rack.destroy process_success object: @rack else process_error object: @rack end end |
#edit ⇒ Object
23 24 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 23 def edit end |
#index ⇒ Object
5 6 7 8 9 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 5 def index @racks = ForemanDatacenter::Rack. includes(:site, :rack_group, :devices). all end |
#new ⇒ Object
19 20 21 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 19 def new @rack = ForemanDatacenter::Rack.new end |
#rack_groups ⇒ Object
11 12 13 14 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 11 def rack_groups @rack_groups = RackGroup.where(site_id: params[:site_id]).all render partial: 'rack_groups' end |
#show ⇒ Object
16 17 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 16 def show end |
#update ⇒ Object
36 37 38 39 40 41 42 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 36 def update if @rack.update(rack_params) process_success object: @rack else process_error object: @rack end end |