title: s3_direct_upload is not working in production server
body: <p>In Rails 4.0.2, I am using <code>s3_direct_upload</code> and <code>aws-sdk</code> gems for file uploads for s3 bucket directly. In development environment it is working fine but in production environment it is throwing an error like below,</p>
  
  <pre><code>ActionView::Template::Error (no implicit conversion of nil into String)
  </code></pre>
  
  <p>In views,</p>
  
  <pre><code>&lt;%= s3_uploader_form :callback_url=&gt;create_cv_url, :id=&gt; "s3_uploader", :key=&gt; "cv_uploads/{unique_id}/${filename}",
    :key_starts_with=&gt; "cv_uploads/", :callback_param=&gt; "cv[direct_upload_url]", :max_file_size=&gt; 1.megabytes,
    :expiration=&gt; 24.hours.from_now.utc.iso8601 do %&gt;
  
     &lt;%= file_field_tag :file, multiple: true, :max_file_size =&gt; 1.megabytes, accept: 'application/pdf application/msword application/rtf application/doc application/docx' %&gt;
  
  &lt;% end %&gt;
  
  &lt;script id="template-upload" type="text/x-tmpl"&gt;
  &lt;div id="upload_{%=o.unique_id%}" class="upload"&gt;
    &lt;h5 class="mt1"&gt;Please Wait. &lt;span style="color: #5f6fa0;"&gt; {%=o.name%} &lt;/span&gt;is processing...&lt;/h5&gt;
    &lt;div class="progress"&gt;&lt;div class="progress-bar progress-bar-striped active" style="width: 0%;"&gt;&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here, the issue is mainly pointing to <code>s3_uploader_form</code> line(in views).</p>
  
  <p>This feature is fully referred from <a href="http://blog.littleblimp.com/post/53942611764/direct-uploads-to-s3-with-rails-paperclip-and">http://blog.littleblimp.com/post/53942611764/direct-uploads-to-s3-with-rails-paperclip-and</a></p>
  
  <p>In paperclip.rb</p>
  
  <pre><code>Paperclip::Attachment.default_options.merge!(
   url:                  :s3_domain_url,
   path:                 ':class/:attachment/:id/:style/:filename',
   storage:              :s3,
   s3_credentials:       Rails.configuration.aws,
   s3_permissions:       :private,
   s3_protocol:          'http'
  )
  
  require 'paperclip/media_type_spoof_detector'
   module Paperclip
   class MediaTypeSpoofDetector
     def spoofed?
      false
     end
   end
  end    
  </code></pre>
  
  <p>In aws.rb</p>
  
  <pre><code>require 'aws-sdk'
  # Rails.configuration.aws is used by AWS, Paperclip, and S3DirectUpload
  Rails.configuration.aws = YAML.load(ERB.new(File.read("#   {Rails.root}/config/aws.yml")).result)[Rails.env].symbolize_keys!
  AWS.config(:logger=&gt; Rails.logger)
  AWS.config(Rails.configuration.aws)
  </code></pre>
  
  <p>In s3_direct_upload.rb</p>
  
  <pre><code>S3DirectUpload.config do |c|
   c.access_key_id     = Rails.configuration.aws[:access_key_id]
   c.secret_access_key = Rails.configuration.aws[:secret_access_key]
   c.bucket            = Rails.configuration.aws[:bucket]
   c.region            = "s3"
  end
  </code></pre>
  
  <p>Is it because of configuration issue in production environment? Please help me to solve this issue.</p>