title: Uniinitialized Constant while deploying rails application
body: <p>I am trying to deploy a rails 4 app to production with the rack attack middleware, but its erroring out during the load process.</p>
  
  <pre><code>    [2014-06-26T17:00:10.247426 #30561] ERROR -- : uninitialized constant Rack::Attack (NameError)
  /home/deploy/apps/dieuDonne/releases/20140626205924/config/application.rb:29:in `&lt;class:Application&gt;'
  /home/deploy/apps/dieuDonne/releases/20140626205924/config/application.rb:12:in `&lt;module:Wizard&gt;'
  /home/deploy/apps/dieuDonne/releases/20140626205924/config/application.rb:11:in `&lt;top (required)&gt;'
  /home/deploy/apps/dieuDonne/releases/20140626205924/config/environment.rb:2:in `require'
  /home/deploy/apps/dieuDonne/releases/20140626205924/config/environment.rb:2:in `&lt;top (required)&gt;'
  config.ru:4:in `require'
  config.ru:4:in `block in &lt;main&gt;'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `&lt;main&gt;'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn.rb:48:in `eval'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn.rb:48:in `block in builder'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:764:in `call'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:764:in `build_app!'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:628:in `init_worker_process'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:651:in `worker_loop'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:536:in `maintain_worker_count'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:294:in `join'
  /home/deploy/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/unicorn-4.8.3/bin/unicorn:126:in `&lt;top (required)&gt;'
  /home/deploy/.rbenv/versions/2.0.0-p353/bin/unicorn:23:in `load'
  /home/deploy/.rbenv/versions/2.0.0-p353/bin/unicorn:23:in `&lt;main&gt;'
  E, [2014-06-26T17:00:10.264215 #29381] ERROR -- : reaped #&lt;Process::Status: pid 30561 exit 1&gt; worker=1
  I, [2014-06-26T17:00:10.264613 #29381]  INFO -- : worker=1 spawning...
  
  I, [2014-06-26T17:00:10.269636 #30567]  INFO -- : worker=1 spawned pid=30567
  I, [2014-06-26T17:00:10.272775 #30567]  INFO -- : Refreshing Gem list
  
  E, [2014-06-26T17:00:10.996570 #30564] ERROR -- : uninitialized constant Rack::Attack (NameError)
  </code></pre>
  
  <p>Here is the gem list from my deploy process.</p>
  
  <pre><code>DEBUG[28cd8523]     Using rake 10.3.2
  DEBUG[28cd8523]     Using i18n 0.6.9
  DEBUG[28cd8523]     Using minitest 4.7.5
  DEBUG[28cd8523]     Using multi_json 1.10.1
  DEBUG[28cd8523]     Using thread_safe 0.3.4
  DEBUG[28cd8523]     Using tzinfo 0.3.39
  DEBUG[28cd8523]     Using activesupport 4.0.2
  DEBUG[28cd8523]     Using builder 3.1.4
  DEBUG[28cd8523]     Using erubis 2.7.0
  DEBUG[28cd8523]     Using rack 1.5.2
  DEBUG[28cd8523]     Using rack-test 0.6.2
  DEBUG[28cd8523]     Using actionpack 4.0.2
  DEBUG[28cd8523]     Using mime-types 1.25.1
  DEBUG[28cd8523]     Using polyglot 0.3.5
  DEBUG[28cd8523]     Using treetop 1.4.15
  DEBUG[28cd8523]     Using mail 2.5.4
  DEBUG[28cd8523]     Using actionmailer 4.0.2
  DEBUG[28cd8523]     Using arbre 1.0.1
  DEBUG[28cd8523]     Using sass 3.2.19
  DEBUG[28cd8523]     Using thor 0.19.1
  DEBUG[28cd8523]     Using bourbon 3.2.3
  DEBUG[28cd8523]     Using coffee-script-source 1.7.0
  DEBUG[28cd8523]     Using execjs 2.1.0
  DEBUG[28cd8523]     Using coffee-script 2.2.0
  DEBUG[28cd8523]     Using railties 4.0.2
  DEBUG[28cd8523]     Using coffee-rails 4.0.1
  DEBUG[28cd8523]     Using formtastic 2.3.0.rc3
  DEBUG[28cd8523]     Using has_scope 0.6.0.rc
  DEBUG[28cd8523]     Using responders 1.0.0
  DEBUG[28cd8523]     Using inherited_resources 1.4.1
  DEBUG[28cd8523]     Using jquery-rails 3.1.0
  DEBUG[28cd8523]     Using jquery-ui-rails 4.2.1
  DEBUG[28cd8523]     Using kaminari 0.15.1
  DEBUG[28cd8523]     Using activemodel 4.0.2
  DEBUG[28cd8523]     Using activerecord-deprecated_finders 1.0.3
  DEBUG[28cd8523]     Using arel 4.0.2
  DEBUG[28cd8523]     Using activerecord 4.0.2
  DEBUG[28cd8523]     Using bundler 1.6.2
  DEBUG[28cd8523]     Using hike 1.2.3
  DEBUG[28cd8523]     Using tilt 1.4.1
  DEBUG[28cd8523]     Using sprockets 2.11.0
  DEBUG[28cd8523]     Using sprockets-rails 2.0.1
  DEBUG[28cd8523]     Using rails 4.0.2
  DEBUG[28cd8523]     Using polyamorous 1.0.0
  DEBUG[28cd8523]     Using ransack 1.2.3
  DEBUG[28cd8523]     Using sass-rails 4.0.3
  DEBUG[28cd8523]     Using activeadmin 1.0.0.pre from git://github.com/gregbell/active_admin.git (at master)
  DEBUG[28cd8523]     Using bcrypt 3.1.7
  DEBUG[28cd8523]     Using cancan 1.6.10
  DEBUG[28cd8523]     Using colorize 0.7.3
  DEBUG[28cd8523]     Using net-ssh 2.9.1
  DEBUG[28cd8523]     Using net-scp 1.2.1
  DEBUG[28cd8523]     Using sshkit 1.5.1
  DEBUG[28cd8523]     Using capistrano 3.2.1
  DEBUG[28cd8523]     Using capistrano-bundler 1.1.2
  DEBUG[28cd8523]     Using capistrano-rails 1.1.1
  DEBUG[28cd8523]     Using capistrano-rbenv 2.0.2
  DEBUG[28cd8523]     Using json 1.8.1
  DEBUG[28cd8523]     Using carrierwave 0.10.0
  DEBUG[28cd8523]     Using daemons 1.1.9
  DEBUG[28cd8523]     Using delayed_job 4.0.1
  DEBUG[28cd8523]     Using delayed_job_active_record 4.0.1
  DEBUG[28cd8523]     Using orm_adapter 0.5.0
  DEBUG[28cd8523]     Using warden 1.2.3
  DEBUG[28cd8523]     Using devise 3.2.4
  DEBUG[28cd8523]     Using diff-lcs 1.2.5
  DEBUG[28cd8523]     Using excon 0.34.0
  DEBUG[28cd8523]     Using formatador 0.2.5
  DEBUG[28cd8523]     Using fog-core 1.22.0
  DEBUG[28cd8523]     Using fog-json 1.0.0
  DEBUG[28cd8523]     Using fog-brightbox 0.0.2
  DEBUG[28cd8523]     Using ipaddress 0.8.0
  DEBUG[28cd8523]     Using mini_portile 0.6.0
  DEBUG[28cd8523]     Using nokogiri 1.6.2.1
  DEBUG[28cd8523]     Using fog 1.22.1
  DEBUG[28cd8523]     Using jbuilder 1.5.3
  DEBUG[28cd8523]     Using jquery-fileupload-rails 0.4.1
  DEBUG[28cd8523]     Using kgio 2.9.2
  DEBUG[28cd8523]     Using liquid 2.6.1
  DEBUG[28cd8523]     Using subexec 0.2.3
  DEBUG[28cd8523]     Using mini_magick 3.7.0
  DEBUG[28cd8523]     Using pg 0.17.1
  DEBUG[28cd8523]     Using rack-attack 4.1.0
  DEBUG[28cd8523]     Using raindrops 0.13.0
  DEBUG[28cd8523]     Using rdoc 4.1.1
  DEBUG[28cd8523]     Using rmagick 2.13.2
  DEBUG[28cd8523]     Using rolify 3.4.0
  DEBUG[28cd8523]     Using rspec-core 2.14.8
  DEBUG[28cd8523]     Using rspec-expectations 2.14.5
  DEBUG[28cd8523]     Using rspec-mocks 2.14.6
  DEBUG[28cd8523]     Using rspec 2.14.1
  DEBUG[28cd8523]     Using sdoc 0.4.0
  DEBUG[28cd8523]     Using uglifier 2.5.0
  DEBUG[28cd8523]     Using unicorn 4.8.3
  DEBUG[28cd8523]     Using wicked 1.0.3
  DEBUG[28cd8523]     Your bundle is complete!
  DEBUG[28cd8523]     Gems in the groups development and test were not installed.
  DEBUG[28cd8523]     It was installed into /home/deploy/apps/&lt;appname&gt;/shared/vendor/bundle
  </code></pre>
  
  <p>My application.rb looks like this:</p>
  
  <pre><code>require File.expand_path('../boot', __FILE__)
  
  require 'rails/all'
  require 'rubygems'
  require 'rack'
  
  # Require the gems listed in Gemfile, including any gems
  # you've limited to :test, :development, or :production.
  Bundler.require(:default, Rails.env)
  
  module Wizard
    class Application &lt; Rails::Application
      # Settings in config/environments/* take precedence over those specified here.
      # Application configuration should go into files in config/initializers
      # -- all .rb files in that directory are automatically loaded.
  
      # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
      # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
      # config.time_zone = 'Central Time (US &amp; Canada)'
  
      # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
      # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
      # config.i18n.default_locale = :de
      config.app_generators.scaffold_controller = :scaffold_controller
  
      # we dont really care for localization.
      config.i18n.enforce_available_locales = false
      config.autoload_paths &lt;&lt; Rails.root.join('lib', 'shared/vendor/bundle/*')
      config.middleware.use Rack::Attack
    end
  end
  </code></pre>