Class: ExportFilesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ExportFilesController
- Defined in:
- app/controllers/export_files_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /export_files POST /export_files.json.
-
#destroy ⇒ Object
DELETE /export_files/1 DELETE /export_files/1.json.
-
#edit ⇒ Object
GET /export_files/1/edit.
-
#index ⇒ Object
GET /export_files GET /export_files.json.
-
#new ⇒ Object
GET /export_files/new GET /export_files/new.json.
-
#show ⇒ Object
GET /export_files/1 GET /export_files/1.json.
-
#update ⇒ Object
PUT /export_files/1 PUT /export_files/1.json.
Instance Method Details
#create ⇒ Object
POST /export_files POST /export_files.json
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/export_files_controller.rb', line 65 def create @export_file = ExportFile.new(params[:export_file]) @export_file.user = current_user respond_to do |format| if @export_file.save format.html { redirect_to @export_file, :notice => ' export file was successfully created.' } format.json { render :json => @export_file, :status => :created, location: @export_file } else format.html { render :action => "new" } format.json { render :json => @export_file.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /export_files/1 DELETE /export_files/1.json
98 99 100 101 102 103 104 105 106 |
# File 'app/controllers/export_files_controller.rb', line 98 def destroy @export_file = ExportFile.find(params[:id]) @export_file.destroy respond_to do |format| format.html { redirect_to export_files_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /export_files/1/edit
59 60 61 |
# File 'app/controllers/export_files_controller.rb', line 59 def edit @export_file = ExportFile.find(params[:id]) end |
#index ⇒ Object
GET /export_files GET /export_files.json
6 7 8 9 10 11 12 13 |
# File 'app/controllers/export_files_controller.rb', line 6 def index @export_files = ExportFile.page(params[:page]) respond_to do |format| format.html # index.html.erb format.json { render :json => @export_files } end end |
#new ⇒ Object
GET /export_files/new GET /export_files/new.json
49 50 51 52 53 54 55 56 |
# File 'app/controllers/export_files_controller.rb', line 49 def new @export_file = ExportFile.new respond_to do |format| format.html # new.html.erb format.json { render :json => @export_file } end end |
#show ⇒ Object
GET /export_files/1 GET /export_files/1.json
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/export_files_controller.rb', line 17 def show @export_file = ExportFile.find(params[:id]) respond_to do |format| format.html { # show.html.erb if params[:mode] == 'download' if @export_file.state == 'completed' redirect_to export_file_path(@export_file, :format => :csv) #render 'download' else redirect_to(@export_file, :notice => 'in process') end end } format.json { render :json => @export_file } format.js format.csv { if @export_file.state == 'completed' if configatron.uploaded_file.storage == :s3 redirect_to @export_file.export.expiring_url(10) else send_file @export_file.export.path, :disposition => 'attachment' end else not_found end } end end |
#update ⇒ Object
PUT /export_files/1 PUT /export_files/1.json
82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'app/controllers/export_files_controller.rb', line 82 def update @export_file = ExportFile.find(params[:id]) respond_to do |format| if @export_file.update_attributes(params[:export_file]) format.html { redirect_to @export_file, :notice => ' export file was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @export_file.errors, :status => :unprocessable_entity } end end end |