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?
# 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
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!