title: NameError (uninitialized constant Unzipper::Zip) but only on Heroku deploy (Rails)
body: <p>I have a class <code>unzipper.rb</code> that unzips a file using Rubyzip.</p>
  
  <p>In my local environment, I can succesfully unzip a file without explictly including the dependency using <code>require 'zip'</code> </p>
  
  <p>On Heroku though, I get an <code>NameError (uninitialized constant Unzipper::Zip)</code> which I could only resolve by using the explict <code>require</code></p>
  
  <p><strong>Question:</strong> Why would this be necessary in the Heroku environment, but not on localhost? I was under the impression that Rails required all gems automatically.</p>
  
  <p><strong>app/services/unzipper.rb</strong></p>
  
  <pre><code>require 'zip'  # Only required for Heroku. Works locally without!
  
  class Unzipper
  
    OVERRIDE_FILES = true
  
    def initialize(file)
      @file = file
    end
  
    def self.unzip(file, &amp;block)
      Unzipper.new(file).unzip(&amp;block)
    end
  
    def unzip
      open_zip do |zip|
        yield extract_files(zip)
      end
    end
  
    private
  
    def open_zip(&amp;block)
      ::Zip::File.open(@file.path, &amp;block)
    end
  
    def extract_files(zip)
      files = []
      zip.each do |entry|
        path = "#{rails_temp_directory}/#{entry.name}"
        entry.extract(path) { OVERRIDE_FILES }
        files &lt;&lt; path
      end
      files
    end
  
    def rails_temp_directory
      "#{Rails.root}/tmp"
    end
  end
  </code></pre>
  
  <p>Heroku output when running bundler includes:</p>
  
  <pre><code>remote:        Using rubyzip 1.1.7
  </code></pre>
  
  <p>I verified both are using the same version of Ruby.</p>
  
  <p>There is no initializer or environment config for Rubyzip.</p>
  
  <p><strong>Gemfile</strong></p>
  
  <pre><code>source 'https://rubygems.org'
  
  gem 'rails', '4.2.0'
  
  gem 'pg', group: :production
  
  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 'sdoc', '~&gt; 0.4.0', group: :doc
  
  gem 'slim-rails'
  
  gem 'paperclip'
  gem 'rest-client'
  
  gem 'bootstrap-sass', '~&gt; 3.3.3'
  
  gem 'validates_serialized'
  
  gem 'puma'
  
  gem "nokogiri"
  gem "cocoon"
  gem 'sidekiq'
  gem 'sinatra', :require =&gt; nil # For sidekiq web monitoring
  gem 'aws-sdk', '&lt; 2.0'
  gem 'rails_12factor', group: :production
  gem 'rubyzip'
  
  group :development, :test do
    gem 'byebug'
  
    gem 'web-console', '~&gt; 2.0'
  
    gem 'spring'
  
    gem 'sqlite3'
  
    gem 'shoulda-matchers'
    gem 'rspec-rails'
    gem 'factory_girl_rails'
    gem 'capybara'
    gem 'selenium-webdriver'
    gem 'database_cleaner'
    gem 'guard-rspec'
    gem 'faker'
  end
  
  group :test do 
    gem 'webmock'
  end
  
  ruby '2.2.0'
  </code></pre>