Class: Dunlop::TargetFilesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ApplicationController
- Dunlop::TargetFilesController
- Defined in:
- app/controllers/dunlop/target_files_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#destroy ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/dunlop/target_files_controller.rb', line 22 def destroy :destroy, @target_file @target_file.destroy redirect_to dunlop.target_files_path, notice: t('action.destroy.successfull', model: @target_file.class.model_name.human) end |
#download ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/dunlop/target_files_controller.rb', line 16 def download :download, @target_file Dunlop::TargetFileDownload.create user: current_user, target_file: @target_file send_file @target_file.original_file.current_path end |
#index ⇒ Object
5 6 7 8 9 10 |
# File 'app/controllers/dunlop/target_files_controller.rb', line 5 def index :index, TargetFile @q = TargetFile.where(sti_type: TargetFile.classes.select{|cls| can? :read, cls}.map(&:name)).search(params[:q]) @q.sorts = "created_at desc" if @q.sorts.empty? @target_files = @q.result.page(params[:page]).per(100) end |
#show ⇒ Object
12 13 14 |
# File 'app/controllers/dunlop/target_files_controller.rb', line 12 def show :read, @target_file end |