title: What does this error mean in Rails: "Errno::ENOENT in AssetsController#get ...No such file or directory...."
body: <p>Im writing an app to store files on Amazon S3. Im pretty close, Im able to save and retrieve files using a url. However since these links are public Im trying to use the following method in my assetscontroller to retrieve stored files from S3.</p>
  
  <p>As links these files can be viewed/accessed in the browser, but if I use this code :</p>
  
  <pre><code>#This action will let the users download the files (after a simple authorization check)
  def get
    asset = current_user.assets.find_by_id(params[:id])
    if asset
    #Parse the URL for special characters first before downloading  
    data = open("#{URI.parse(URI.encode(asset.uploaded_file.url))}")
    #then again, use the "send_data" method to send the above binary "data" as file.  
     send_data data, :filename =&gt; asset.uploaded_file_file_name 
  
   else
     flash[:error]="Access Violation"
     redirect_to assets_path
   end
  </code></pre>
  
  <p>end</p>
  
  <p>Im getting this error in my browser:</p>
  
  <pre><code>Errno::ENOENT in AssetsController#get
  No such file or directory - http://s3.amazonaws.com/BUCKETNAME/assets/29/FILENAME.jpeg?    1339979591
  </code></pre>
  
  <p>When I click on the resource on the S3 site as Im logged into the S3 management console, the file is shown in my browser and its link is </p>
  
  <pre><code>https://s3.amazonaws.com/BUCKETNAME/assets/29/FILENAME.jpeg?     AWSAccessKeyId=XXXXXXXXXXXExpires=1340003832&amp;Signature=XXXXXXXXXXXXXXXXXX-amz-security-      token=XXXXXXXXX//////////XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  </code></pre>
  
  <p>So it does exist but cant be accessed through my app</p>
  
  <p>Here is my Application Trace from my browser:</p>
  
  <pre><code>app/controllers/assets_controller.rb:99:in `initialize'
  app/controllers/assets_controller.rb:99:in `open'
  app/controllers/assets_controller.rb:99:in `get'
  </code></pre>
  
  <p>Any clues on whats going on?</p>
  
  <p>Thanks</p>