on-site / grantzilla

A grant application management web app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix AWS Upload Document Issue

joedean opened this issue · comments

`ActiveRecord::RecordInvalid` - Validation failed: File can't be blank:
  activerecord (5.0.0) lib/active_record/validations.rb:78:in `raise_validation_error'
  activerecord (5.0.0) lib/active_record/validations.rb:50:in `save!'
  activerecord (5.0.0) lib/active_record/attribute_methods/dirty.rb:30:in `save!'
  activerecord (5.0.0) lib/active_record/transactions.rb:324:in `block in save!'
that's the actual error
@@ -9,7 +9,7 @@ class UploadsController < ApplicationController
   def create
     @upload = Upload.new(upload_params)
 
-    if @upload.save
+    if @upload.save!
       redirect_to :back, notice: 'File was successfully uploaded.'
     else
       redirect_to :back, alert: 'Failed to upload file.'
so that's it`

Fixed