title: NameError: uninitialized constant Carrierwave (Deploy to Heroku)
body: <p>I'm using Carrierwave to upload images but I having some issues: This is the log from heroku:</p>
  
  <pre><code> Running `rake db:migrate` attached to terminal... up, run.2276
  rake aborted!
  NameError: uninitialized constant Carrierwave
  /app/config/initializers/carrier_wave.rb:2:in `&lt;top (required)&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:652:in `block in load_config_initializer'
  /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb:166:in `instrument'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:651:in `load_config_initializer'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:616:in `block (2 levels) in &lt;class:Engine&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:615:in `each'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:615:in `block in &lt;class:Engine&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `each'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `tsort_each_child'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
  /app/config/environment.rb:5:in `&lt;top (required)&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:443:in `block in run_tasks_blocks'
  Tasks: TOP =&gt; db:migrate =&gt; environment
  (See full trace by running task with --trace)
  WARNING: Toolbelt v3.36.4 update available.
  </code></pre>
  
  <p>Here are my files:</p>
  
  <p>carrier_wave.rb:</p>
  
  <pre><code>    if Rails.env.production?
      Carrierwave.configure do |config|
          config.fog_credentials = {
              :provider =&gt; 'AWS',
              :aws_access_key_id =&gt; ENV['S3_ACCESS_KEY'],
              :aws_secrety_access_key =&gt; ENV['S3_SECRET_KEY']
          }
          config.fog_directory = ENV['S3_BUCKET']
      end 
  end
  </code></pre>
  
  <p>Application.rb:</p>
  
  <pre><code>    require File.expand_path('../boot', __FILE__)
  
  require 'rails/all'
  require 'carrierwave'
  
  Bundler.require(*Rails.groups)
  
  module MagicRecipes
    class Application &lt; Rails::Application
  
      config.autoload_paths += %W(#{config.root}/app/uploaders)
  
      config.serve_static_files = true
  
      config.active_record.raise_in_transactional_callbacks = true
      config.assets.initialize_on_precompile = false
    end
  end
  
  picture_uploader.rb
  
      class PictureUploader &lt; CarrierWave::Uploader::Base
  
  
    include CarrierWave::MiniMagick
    process resize_to_limit: [600, 600]
  
  
    if Rails.env.production?
      storage :fog
    else
      storage :file
  
    end
  
    def store_dir
      "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end
  
  
      def extension_white_list
        %w(jpg jpeg gif png)
      end
  
  
  
  end
  </code></pre>
  
  <p>Here is my Gemfile:</p>
  
  <pre><code>source 'https://rubygems.org'
  
  gem 'rails', '4.2.0'
  gem 'pg', '~&gt; 0.18.1'
  gem 'sass-rails', '~&gt; 5.0'
  gem 'uglifier', '&gt;= 1.3.0'
  gem 'coffee-rails', '~&gt; 4.1.0'
  gem 'jquery-rails'
  gem 'turbolinks'
  gem 'jbuilder', '~&gt; 2.0'
  
  gem 'rails_12factor', '~&gt; 0.0.3'
  gem 'bootstrap-sass', '~&gt; 3.3.4.1'
  gem 'devise', '~&gt; 3.4.1'
  gem 'paperclip', '~&gt; 4.2.1'
  gem 'aws-sdk', '~&gt; 1.59.1'
  gem 'will_paginate', '~&gt; 3.0.7'
  gem 'pry', '~&gt; 0.10.1'
  gem 'will_paginate-bootstrap', '~&gt; 1.0.1'
  gem 'carrierwave', '~&gt; 0.10.0'
  </code></pre>
  
  <p><code>enter code here</code>gem 'mini_magick', '~> 3.8.0'
  <code>enter code here</code>gem 'fog', '~> 1.23.0'
  <code>enter code here</code>gem 'sdoc', '~> 0.4.0', group: :doc</p>
  
  <p>group :development, :test do
    gem 'byebug'
    gem 'web-console', '~> 2.0'
    gem 'spring'
  end </p>
  
  <p>I have the gems and versions installed in my gemfile.</p>
  
  <p>I don't know what is the problem, I did a entire research but I can solve the problem.</p>
  
  <p>Thanks</p>