title: Best way to handle missing required params with StrongParameters?
body: <p>I have an <code>Upload</code> ActiveModel class that has one attribute: <code>filename</code>.  Since there's only one attribute, leaving the field blank on the form ends up raising an error when using the following code in my controller:</p>
  
  <pre><code>class UploadsController &lt; ApplicationController
    def create
      @upload = Upload.new(upload_params)
      # ...
    end
  
    private
  
    def upload_params
      params.require(:upload).permit(:filename)
    end
  end
  </code></pre>
  
  <p>The best workaround I've come up with is to <code>rescue</code> in the <code>upload_params</code> method, e.g.:</p>
  
  <pre><code>def upload_params
    params.require(:upload).permit(:filename) rescue ActionController::Parameters.new
  end
  </code></pre>
  
  <p>Alternatively, I suppose I could add a hidden field to ensure that the <code>filename</code> field is always set to something no matter what, e.g.:</p>
  
  <pre><code>= simple_form_for upload do |f|
    = f.input :filename, as: :hidden, input_html: { value: '' }
    = f.input :filename, as: :file
    = f.submit 'Upload'
  </code></pre>
  
  <p>Is there a better way of handling the user not filling out any of the form attributes?</p>