Class: WcoHosting::FilesController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- WcoHosting::FilesController
- Defined in:
- app/controllers/wco_hosting/files_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 16 |
# File 'app/controllers/wco_hosting/files_controller.rb', line 4 def create @file = WcoHosting::File.new params[:file].permit! :create, @file flag = @file.save if flag flash[:notice] = 'Success.' redirect_to action: :index else flash[:alert] = "Cannot create file: #{@file.errors.full_messages.join(', ')}." render action: :index end end |
#edit ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/wco_hosting/files_controller.rb', line 18 def edit @file = WcoHosting::File.find params[:id] :edit, @file @serverhost = @file.serverhost end |
#index ⇒ Object
25 26 27 28 29 |
# File 'app/controllers/wco_hosting/files_controller.rb', line 25 def index :index, WcoHosting::File @files = WcoHosting::File.all @new_file = WcoHosting::File.new end |
#new ⇒ Object
31 32 33 34 |
# File 'app/controllers/wco_hosting/files_controller.rb', line 31 def new :index, WcoHosting::File @new_file = WcoHosting::File.new end |
#show ⇒ Object
36 37 38 39 |
# File 'app/controllers/wco_hosting/files_controller.rb', line 36 def show @file = WcoHosting::File.find params[:id] :show, @file end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/wco_hosting/files_controller.rb', line 41 def update @file = WcoHosting::File.find params[:id] :update, @file if @file.update_attributes( params[:file].permit! ) flash_notice @file else flash_alert @file end redirect_to request.referrer end |