title: Why do I get Rails 4.0.2 Hash#diff Deprecation warning inside of Middleware/Rack?
body: <p>I am upgrading a Rails 3.2 app to Rails 4 and am running into an issue with some rack middleware:</p>
  
  <p>I am getting the following error: <code>DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead.</code></p>
  
  <p>The line that appears to be triggering it is <code>@app.call(env)</code> from the below:</p>
  
  <pre><code> class NoWww
  
    def initialize(app)
      @app = app
    end
  
    def call(env)
  
      request = Rack::Request.new(env)
  
      if request.host =~ /^[^.]+\.[^.]+$/
        [301, {"Location" =&gt; request.url.sub("//","//www.")}, self]
      else
        @app.call(env)
      end
  
    end
  
  
    def each(&amp;block)
    end
  
  end
  </code></pre>
  
  <p>Note sure how the <code>@app.call(env)</code> is triggering this Hash#Diff Deprecation warning...?</p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>My Middleware Stack is as follows:</p>
  
  <pre><code>use Rack::Sendfile
  use ActionDispatch::Static
  use Rack::Rewrite
  use Rack::Lock
  use #&lt;ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x0000010369c180&gt;
  use Rack::Runtime
  use Rack::MethodOverride
  use ActionDispatch::RequestId
  use Rails::Rack::Logger
  use ActionDispatch::ShowExceptions
  use ActionDispatch::DebugExceptions
  use BetterErrors::Middleware
  use ActionDispatch::RemoteIp
  use ActionDispatch::Reloader
  use ActionDispatch::Callbacks
  use ActiveRecord::ConnectionAdapters::ConnectionManagement
  use ActiveRecord::QueryCache
  use ActionDispatch::Cookies
  use ActionDispatch::Session::CookieStore
  use ActionDispatch::Flash
  use ActionDispatch::ParamsParser
  use Rack::Head
  use Rack::ConditionalGet
  use Rack::ETag
  use NoWww
  use OmniAuth::Builder
  run JobBoard::Application.routes
  </code></pre>