title: Carrierwave setup
body: <p>please, could you please have a look to my config? I'm trying to setup carrierwave in my app but it doesn't work in the production server. It's working locally even as production environment. The thing is that it's saving the images into the tmp directory but the result is 'Empty file upload result'. I tried save to file and save to S3, same result. I'm using Passenger - Nginx. </p>
  
  <p>I'm getting mad with this for two days now. Any idea or tip even about how I can debug this is welcome. I setup all permissions so I don't think it's a permissions issue. It could be a cache thing, the files are stored into tmp directory but it seems that the app don't see them as owned by the user???  </p>
  
  <p>Thanks!!!</p>
  
  <pre><code>#application.rb
  
  require File.expand_path('../boot', __FILE__)
  
  require 'rails/all'
  
  if defined?(Bundler)
    Bundler.require(*Rails.groups(:assets =&gt; %w(development test)))
  end
  
  module MyApp
    class Application &lt; Rails::Application
      config.encoding = "utf-8"
      config.filter_parameters += [:password]
      config.active_support.escape_html_entities_in_json = true
      config.active_record.whitelist_attributes = true
      config.assets.initialize_on_precompile = false
      config.assets.enabled = true
      config.assets.version = '1.0'
    end
  end
  
  
  
  # avatar_uploader.rb
  
  class AvatarUploader &lt; CarrierWave::Uploader::Base
    include CarrierWave::MiniMagick
    include ActiveModel::Conversion
    extend ActiveModel::Naming
    def extension_white_list
    %w(jpg jpeg gif png mp3)
  end
    include Sprockets::Helpers::RailsHelper
    include Sprockets::Helpers::IsolatedHelper
  
    storage :fog
  
    def store_dir
      "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end
  
    version :thumb do
      process :resize_to_fill =&gt; [200,200]
    end
  
  end
  
  
  
  # carrierwave.rb
  
  CarrierWave.configure do |config|
    config.fog_credentials = {
        :provider               =&gt; 'AWS',       # required
        :aws_access_key_id      =&gt; 'ACCESS',       # required
        :aws_secret_access_key  =&gt; 'SECRET',       # required
        :region                 =&gt; 'eu-west-1'  # optional, defaults to 'us-east-1'
    }
      config.fog_directory  = 'my_app_bucket' 
    end
  
  
  
  # production.rb 
  
  MyApp::Application.configure do
  
    config.cache_classes = true
    config.consider_all_requests_local       = true # default false, debug true
    config.action_controller.perform_caching = true #default true
    config.serve_static_assets = true  # Carrierwave true - Default false
    config.assets.compress = true
    config.assets.compile = false # false for real production
    config.assets.digest = true
    config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
    config.log_level = :debug
    config.cache_store = :dalli_store
    config.assets.precompile += %w( search.js )
    config.i18n.fallbacks = true
    config.active_support.deprecation = :notify
    config.action_mailer.default_url_options = { :host =&gt; 'localhost' }
  end
  </code></pre>