Class: ImportRequestsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ImportRequestsController
- Defined in:
- app/controllers/import_requests_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /import_requests POST /import_requests.json.
-
#destroy ⇒ Object
DELETE /import_requests/1 DELETE /import_requests/1.json.
-
#edit ⇒ Object
GET /import_requests/1/edit.
-
#index ⇒ Object
GET /import_requests GET /import_requests.json.
-
#new ⇒ Object
GET /import_requests/new GET /import_requests/new.json.
-
#show ⇒ Object
GET /import_requests/1 GET /import_requests/1.json.
-
#update ⇒ Object
PUT /import_requests/1 PUT /import_requests/1.json.
Instance Method Details
#create ⇒ Object
POST /import_requests POST /import_requests.json
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controllers/import_requests_controller.rb', line 42 def create @import_request = ImportRequest.new(import_request_params) @import_request.user = current_user respond_to do |format| if @import_request.save @error_type = @import_request.import! format.html { if @import_request.manifestation redirect_to @import_request.manifestation, notice: t('controller.successfully_created', model: t('activerecord.models.import_request')) elsif @error_type redirect_to new_import_request_url, notice: t("import_request.#{@error_type}") end } #format.html.phone { # if @import_request.manifestation # redirect_to @import_request.manifestation, notice: t('controller.successfully_created', model: t('activerecord.models.import_request')) # else # redirect_to new_import_request_url, notice: t('import_request.record_not_found') # end #} format.json { render json: @import_request, status: :created, location: @import_request } else format.html { render action: "new" } #format.html.phone { render action: "new" } format.json { render json: @import_request.errors, status: :unprocessable_entity } end end rescue Timeout::Error @import_request.transition_to!(:failed) flash[:notice] = t('page.timed_out') redirect_to new_import_request_url end |
#destroy ⇒ Object
DELETE /import_requests/1 DELETE /import_requests/1.json
93 94 95 96 97 98 99 100 |
# File 'app/controllers/import_requests_controller.rb', line 93 def destroy @import_request.destroy respond_to do |format| format.html { redirect_to import_requests_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.import_request')) } format.json { head :no_content } end end |
#edit ⇒ Object
GET /import_requests/1/edit
37 38 |
# File 'app/controllers/import_requests_controller.rb', line 37 def edit end |
#index ⇒ Object
GET /import_requests GET /import_requests.json
7 8 9 10 11 12 13 14 |
# File 'app/controllers/import_requests_controller.rb', line 7 def index @import_requests = ImportRequest.page(params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @import_requests } end end |
#new ⇒ Object
GET /import_requests/new GET /import_requests/new.json
27 28 29 30 31 32 33 34 |
# File 'app/controllers/import_requests_controller.rb', line 27 def new @import_request = ImportRequest.new respond_to do |format| format.html # new.html.erb format.json { render json: @import_request } end end |
#show ⇒ Object
GET /import_requests/1 GET /import_requests/1.json
18 19 20 21 22 23 |
# File 'app/controllers/import_requests_controller.rb', line 18 def show respond_to do |format| format.html # show.html.erb format.json { render json: @import_request } end end |
#update ⇒ Object
PUT /import_requests/1 PUT /import_requests/1.json
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'app/controllers/import_requests_controller.rb', line 78 def update respond_to do |format| if @import_request.update(import_request_params) @import_request.import! format.html { redirect_to @import_request, notice: t('controller.successfully_updated', model: t('activerecord.models.import_request')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @import_request.errors, status: :unprocessable_entity } end end end |