Skip to content

Commit 3a51d47

Browse files
mlarrazkjg
authored andcommitted
Avoid alias_method_chain (#118)
This is deprecated as of Rails 5 (in favor of Module#prepend, which is only in Ruby 2+). Since we still have to support Ruby 1.8, just create the aliases manually
1 parent 5a1bafe commit 3a51d47

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/api_auth/railtie.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ def with_api_auth(access_id, secret_key, options = {})
4444
self.api_auth_options = options
4545

4646
class << self
47-
alias_method_chain :connection, :auth
47+
alias_method :connection_without_auth, :connection
48+
alias_method :connection, :connection_with_auth
4849
end
4950
end
5051

@@ -64,7 +65,9 @@ module InstanceMethods
6465

6566
module Connection
6667
def self.included(base)
67-
base.send :alias_method_chain, :request, :auth
68+
base.send :alias_method, :request_without_auth, :request
69+
base.send :alias_method, :request, :request_with_auth
70+
6871
base.class_eval do
6972
attr_accessor :hmac_secret_key, :hmac_access_id, :use_hmac, :api_auth_options
7073
end

0 commit comments

Comments
 (0)