cant see the aws-s3 url saved in rails database

I have successfully implemented image uploading using carrierwave, fog and Amazon S3. In my imageuploader am using only fog as storage. But when i check my database i can see that just the file name is written instead of the amazon url. In my views its fetching correctly from aws without any issues.

Is it supposed to be like this? If so how the application figure out the exact url to s3?

imageuploader.rb`

    # encoding: utf-8

class ImageUploader < CarrierWave::Uploader::Base

  # Include RMagick or MiniMagick support:
  # include CarrierWave::RMagick
  # include CarrierWave::MiniMagick
  include CarrierWave::MiniMagick

  #Include the sprockets-rails helper  for Rails 4+ compatibility:
  include Sprockets::Rails::Helper

  storage :fog


  version :index_size do
    process :resize_to_fill => [258, 173]
  end

  version :thumb_size do
    process :resize_to_fill => [100, 100]
  end




  def extension_white_list
     %w(jpg jpeg gif png)
  end



end

Answers


Your config has the bucket name and the database has the filename. These are the only two pieces of information that are actually required to construct a filename (and it can be done without other API calls). The urls are actually pretty regular, so it is fairly straightforward for the server to do this. Hope that helps!


Need Your Help

In eclipse dynamic web project, how to link css to jsp file in webcontent folder

css eclipse jsp tomcat

In Eclipse, I created a Dynamic Web Project and a JSP file under WebContent folder. I also created a CSS file under the WebContent folder. Then I use &lt;link rel="stylesheet" type="text/css" href=...

Need help writing a descrambling method for substitution cipher

java decoding

I need some help on a Java assignment. We are given a scrambled text file, which was scrambled using a substitution cipher, where every letter in the text is simply swapped out for another letter....