Hello,
I'm using carrierwave with carrierwave_direct to upload directly to
S3. Everything works fine without post-processing but when I try to do
the post-processing, I get a 403 forbidden error when trying to
execute the code: self.remote_avatar_url =
avatar.direct_fog_url(:with_path => true)
My full code is:
config:
CarrierWave.configure do |config|
config.storage = :fog
config.fog_directory = S3_CREDENTIALS[:bucket]
config.fog_public = false
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'xxx',
:aws_secret_access_key => 'xxx'
}
end
avatar_uploader.rb:
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
include CarrierWaveDirect::Uploader
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}"
end
version :thumb do
process :resize_to_limit => [50, 50]
end
end
class ClipsController < ApplicationController
def index
if params[:key]
clip = Clip.new
clip.attachable_id = key[3]
clip.attachable_type = "Pmdocument"
clip.key = params[:key]
# clip.save
clip.save_and_process_avatar
end
class Clip < ActiveRecord::Base
def save_and_process_avatar(options = {})
if options[:now] or 1==1
self.remote_avatar_url = avatar.direct_fog_url(:with_path =>
true)
save
else
Resque.enqueue(AvatarProcessor, attributes)
end
en
end
I've been hanging with this for about one day now. So I really need
help... Thanks!