Skip to content

Commit

Permalink
Avoid alias_method_chain (#118)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mlarraz authored and kjg committed Jul 19, 2016
1 parent 5a1bafe commit 3a51d47
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/api_auth/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def with_api_auth(access_id, secret_key, options = {})
self.api_auth_options = options

class << self
alias_method_chain :connection, :auth
alias_method :connection_without_auth, :connection
alias_method :connection, :connection_with_auth
end
end

Expand All @@ -64,7 +65,9 @@ module InstanceMethods

module Connection
def self.included(base)
base.send :alias_method_chain, :request, :auth
base.send :alias_method, :request_without_auth, :request
base.send :alias_method, :request, :request_with_auth

base.class_eval do
attr_accessor :hmac_secret_key, :hmac_access_id, :use_hmac, :api_auth_options
end
Expand Down

0 comments on commit 3a51d47

Please sign in to comment.