From 8b51961c4931565524700c5ebe0576b77eee6d74 Mon Sep 17 00:00:00 2001 From: nov Date: Wed, 20 Jan 2016 13:31:27 +0900 Subject: [PATCH] use prepend, since fb_graph2 doesn't need ruby 1.9.x support close #102 NOTE: we still have alias_method_chain in rack-oauth2 etc. --- lib/patch/rack/oauth2/util.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/patch/rack/oauth2/util.rb b/lib/patch/rack/oauth2/util.rb index 4834015..0dded0b 100644 --- a/lib/patch/rack/oauth2/util.rb +++ b/lib/patch/rack/oauth2/util.rb @@ -1,14 +1,17 @@ # NOTE: Authorization code given via FB JS SDK needs blank string as redirect_uri + module Rack::OAuth2::Util class << self - def compact_hash_with_blank_redirect_uri(hash) - original_redirect_uri = hash[:redirect_uri] - result = compact_hash_without_blank_redirect_uri hash - if original_redirect_uri - result[:redirect_uri] ||= original_redirect_uri + module ComcactHashWithBrankRedirect + def compact_hash(hash) + original_redirect_uri = hash[:redirect_uri] + result = super + if original_redirect_uri + result[:redirect_uri] ||= original_redirect_uri + end + result end - result end - alias_method_chain :compact_hash, :blank_redirect_uri + prepend ComcactHashWithBrankRedirect end end \ No newline at end of file