Versions of all RubyGems. I use Ruby on Rails 3.1.3, Ruby 1.9.2, CarrierWave 0.5.8 and Fog 1.1.2.
I use CarrierWave RubyGem to upload images and Fog RubyGem to upload an Amazon S3 file .
In my CarrierWave initialization file, I have:
CarrierWave.configure do |config| config.fog_credentials = { provider: 'AWS', aws_access_key_id: 'xxx', aws_secret_access_key: 'xxx' } if Rails.env.production? config.fog_directory = 'bucket1' elsif Rails.env.development? config.fog_directory = 'bucket2' else config.fog_directory = 'bucket3' end config.fog_public = false config.fog_authenticated_url_expiration = 60 end
I have an uploader file:
class PageAttachmentUploader < CarrierWave::Uploader::Base CarrierWave.configure do |config| if Rails.env.development? || Rails.env.development? || Rails.env.production? config.fog_public = true end end storage :fog end
I have two uploader files. I want one of them to be closed and the other to be public.
I am trying to overwrite CarrierWave configuration when calling the PageAttachmentUploader method and set the URL for the public. This works like a charm on a local computer, but it does not work at the stage of staging, sandboxing and production.
I changed config.fog_public = true in the CarrierWave interpreter. Even this does not work in the sandbox. How to fix this problem?
source share