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
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 27 def create @rack = ForemanDatacenter::Rack.new(rack_params) if @rack.save process_success object: @rack else process_error object: @rack end end |
#destroy ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 45 def destroy if @rack.destroy process_success object: @rack else process_error object: @rack end end |
#edit ⇒ Object
24 25 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 24 def edit end |
#index ⇒ Object
5 6 7 8 9 10 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 5 def index @racks = ForemanDatacenter::Rack. includes(:site, :rack_group, :devices). order(:name). all end |
#new ⇒ Object
20 21 22 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 20 def new @rack = ForemanDatacenter::Rack.new end |
#rack_groups ⇒ Object
12 13 14 15 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 12 def rack_groups @rack_groups = RackGroup.where(site_id: params[:site_id]).all render partial: 'rack_groups' end |
#show ⇒ Object
17 18 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 17 def show end |
#update ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/controllers/foreman_datacenter/racks_controller.rb', line 37 def update if @rack.update(rack_params) process_success object: @rack else process_error object: @rack end end |