Created
May 23, 2012 23:18
-
-
Save sfaxon/2778446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macten:activeresource sfaxon$ git diff | |
diff --git a/lib/active_resource/base/base_class_methods.rb b/lib/active_resource/base/base_class_methods.rb | |
index c90a304..cca30d6 100644 | |
--- a/lib/active_resource/base/base_class_methods.rb | |
+++ b/lib/active_resource/base/base_class_methods.rb | |
@@ -292,11 +292,7 @@ module ActiveResource | |
# middleware.swap(Faraday::Adapter::NetHttp, Faraday::Adapter::NetHttpPersistent) | |
# this may not stick around, it presents two ways of changing the adapter and format | |
def middleware | |
- if connection.builder.locked? | |
- connection(true).builder | |
- else | |
- connection.builder | |
- end | |
+ connection(true).builder | |
end | |
# Scopes defined for this class | |
@@ -323,7 +319,11 @@ module ActiveResource | |
# or not (defaults to <tt>false</tt>). | |
def connection(refresh = false) | |
if defined?(@connection) || superclass == Object | |
- if refresh || @connection.nil? || adapter == :test | |
+ if refresh | |
+ @connection = @connection.dup | |
+ return @connection | |
+ end | |
+ if @connection.nil? # || adapter == :test | |
@connection = Faraday.new(site) do |builder| | |
# Fill in other options here on builder if possible or use a hash | |
# in the args to Faraday.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment