Class: WcoHosting::EnvironmentsController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- WcoHosting::EnvironmentsController
- Defined in:
- app/controllers/wco_hosting/environments_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/wco_hosting/environments_controller.rb', line 4 def create @environment = WcoHosting::Environment.new params[:environment].permit! :create, @environment if @environment.save flash_notice 'success' else flash_alert @environment end redirect_to action: :index end |
#edit ⇒ Object
17 18 19 20 |
# File 'app/controllers/wco_hosting/environments_controller.rb', line 17 def edit @environment = WcoHosting::Environment.find params[:id] :edit, @environment end |
#index ⇒ Object
22 23 24 25 |
# File 'app/controllers/wco_hosting/environments_controller.rb', line 22 def index :index, WcoHosting::Environment @environments = WcoHosting::Environment.all end |
#new ⇒ Object
28 29 30 31 |
# File 'app/controllers/wco_hosting/environments_controller.rb', line 28 def new :new, WcoHosting::Environment @environment = WcoHosting::Environment.new end |
#show ⇒ Object
33 34 35 36 37 |
# File 'app/controllers/wco_hosting/environments_controller.rb', line 33 def show @environment = WcoHosting::Environment.find params[:id] :show, @environment @subenvironments = WcoHosting::Appliance.where( environment: @environment.name ).map( &:subenvironment ) end |
#update ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/wco_hosting/environments_controller.rb', line 39 def update @environment = WcoHosting::Environment.find params[:id] :update, @environment if @environment.update_attributes( params[:environment].permit! ) flash_notice @environment else flash_alert @environment end redirect_to action: :index end |