title: AWS S3 using s3_direct_upload Gem appears to process but nothing is uploaded to my s3 bucket
body: <p>I had followed the given instructions using the s3_direct_upload Gem.  When I submit the upload form with an attached image a new 'upload' item is created but no image is sent to S3 (or back for display).  </p>
  
  <p>I have a user.rb Model through Devise but the model I'm using for images is upload.rb.  </p>
  
  <p>Here are the logs I'm getting in Development mode when submitting the image form.  You can see that nothing is appended to the new 'upload' item except creation date and an id (everything else is nil).  Side note - should I be seeing my bucket name in here this log (I don't)?</p>
  
  <p>Additional Info:  In my s3 console, I removed the bucket.  I still get the same output below.  So, it seems like it's not even sending the info out to s3?  Any ideas what could cause that?</p>
  
  <blockquote>
    <p>Started POST "/uploads" for 127.0.0.1 at 2013-05-12 19:10:52 -0400
    Processing by UploadsController#create as <em>/</em>   Parameters:
    {"utf8"=>"√", "key"=>"uploads/1368400251964-ol9ja4ijq0110pb9-bf206
    97a98bbff7c58a83d7bfaa84800/${filename}", "acl"=>"public-read",
    "AWSAccessKeyId"
    =>"AKIAI2EXMFCUTILIGG", "policy"=>"eyJleHBpcmF0aW9uIjoiMjAxMy0wNS0xM1QwOToxMDo
    0N1oiLCJjb25kaXRpb25zIjpbWyJzdGFydHMtd2l0aCIsIiR1dGY4IiwiIl0sWyJzdGFydHMtd2l0aCI
    sIiRrZXkiLCJ1cGxvYWRzLyJdLFsic3RhcnRzLXdpdGgiLCIkeC1yZXF1ZXN0ZWQtd2l0aCIsIiJdLFs
    iY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsNTI0Mjg4MDAwXSxbInN0YXJ0cy13aXRoIiwiJGNvbnRlbnQ
    tdHlwZSIsIiJdLHsiYnVja2V0IjoibGl2ZXBlcmNoIn0seyJhY2wiOiJwdWJsaWMtcmVhZCJ9LHsic3V
    jY2Vzc19hY3Rpb25fc3RhdHVzIjoiMjAxIn1dfQ==",
    "signature"=>"f9R5QeLx4nllEKug805CV1 OJTu0=",
    "success_action_status"=>"201", "X-Requested-With"=>"xhr",
    "content-typ e"=>"image/jpeg",
    "file"=>#>}
    ←[1m←[36mUser Load (1.0ms)←[0m  ←[1mSELECT "users".* FROM "users"
    WHERE "users"."id" = 1 LIMIT 1←[0m   ←[1m←[35m (0.0ms)←[0m  BEGIN<br>
    ←[1m←[36mSQL (81.0ms)←[0m  ←[1mINSERT INTO "uploads" ("created_at",
    "image_url", "name", "product_id", "updated_at")  VALUES ($1, $2, $3,
    $4, $5) RETURNING "id"←[0m  [["created_at", Sun, 12 May 2013 23:10:52
    UTC +00:00], ["image_url", nil] , ["name", nil], ["product_id", nil],
    ["updated_at", Sun, 12 May 2013 23:10:52 UTC +00:00]]   ←[1m←[35m
    (18.0ms)←[0m  COMMIT   Rendered uploads/_upload.html.erb (1.0ms)<br>
    Rendered uploads/create.js.erb (4.0ms) Completed 200 OK in 127ms
    (Views: 22.0ms | ActiveRecord: 101.0ms)</p>
  </blockquote>
  
  <p>Here is mu upload.rb model.</p>
  
  <pre><code> class Upload &lt; ActiveRecord::Base
    attr_accessible :image_url, :name, :product_id
    before_create :default_name
     def default_name
      self.name ||= File.basename(image_url, '.*').titleize if image_url
     end  
  end
  </code></pre>
  
  <p>Here is the image form code that triggers the send to s3.</p>
  
  <pre><code> &lt;%= s3_uploader_form callback_url: uploads_url, callback_param: upload[image_url]", id: "myS3Uploader" do %&gt;
    &lt;%= file_field_tag :file, multiple: true %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Here is the initializer file the Gem requires that houses my s3 information.  I edited the Keys and bucket name out.</p>
  
  <pre><code>S3DirectUpload.config do |c|
        c.access_key_id = "AWS_KEY"       # your access key id
        c.secret_access_key = "AWS_SECRET_KEY"   # your secret access key
        c.bucket = "AWS_BUCKET_NAME"              # your bucket name
        c.region = ""              # region prefix of your bucket url (optional), eg. "s3-eu-west-1"
        c.url = ""                 # S3 API endpoint (optional), eg. "https://#{c.bucket}.s3.amazonaws.com/"
      end
  </code></pre>
  
  <p>And, here is the create.js.erb file for the model</p>
  
  <pre><code>&lt;% if @upload.new_record? %&gt;
    alert("Failed to upload: &lt;%= j @upload.errors.full_messages.join(', ').html_safe %&gt;");
  &lt;% else %&gt;
    $("#uploads").append("&lt;%= j render(@upload) %&gt;");
  &lt;% end %&gt;
  </code></pre>
  
  <p>I am a little new to rails and this has been driving me nuts.  I appreciate any help!</p>