title: AWS S3 integration yields undefined method `match'
body: <p>I'm working on a simple project using Paperclip to upload images.  Everything has been working just fine until I attempted to integrate S3 with Paperclip.  Upon 'uploading' a user's image I get a <code>NoMethodError (undefined method 'match' for nil:NilClass):</code> error. This only happens when I have my S3 configuration running - if I comment it out the file uploads perfectly.  </p>
  
  <p>My configuration:</p>
  
  <pre><code>development.rb:
  ....
  ....
    config.paperclip_defaults = {
    :storage =&gt; :s3,
    :s3_credentials =&gt; {
      :bucket =&gt; ENV['AWS_BUCKET_ID'],
      :access_key_id =&gt; ENV['AWS_ACCESS_KEY_ID'],
      :secret_access_key =&gt; ENV['AWS_SECRET_ACCESS_KEY']
    }
  }
  </code></pre>
  
  <p>My Model:</p>
  
  <pre><code> class User &lt; ActiveRecord::Base
          has_attached_file :image_file, default_url: "/myapp/images/:style/missing.png"
          validates_attachment_file_name :image_file, matches: [/png\Z/, /jpeg\Z/, /tiff\Z/, /bmp\Z/, /jpg\Z/]
  </code></pre>
  
  <p>entire error output from console:</p>
  
  <pre><code>NoMethodError (undefined method `match' for nil:NilClass):
    app/controllers/images_controller.rb:33:in `block in create'
    app/controllers/images_controller.rb:32:in `create'
  </code></pre>
  
  <p>Things I tried:</p>
  
  <ul>
  <li><p>I added the AWS keys and bucket name directly into the code instead
  of as an environmental variable.</p></li>
  <li><p>As mentioned above, I commented out the AWS configuration in my environment file and it seemed to work perfectly.</p></li>
  </ul>
  
  <p>It's probably worth mentioning that I installed the <code>fog</code> gem earlier to start configuring for Google Cloud Storage, but decided to stick with S3 instead.  I used <code>gem uninstall fog</code> to remove the gem but it appears some dependencies stayed behind.  </p>