]> git.openstreetmap.org Git - rails.git/blobdiff - config/initializers/oauth.rb
Monkey patch oauth gem to avoid use of deprecated URI.escape
[rails.git] / config / initializers / oauth.rb
index c897785518cd484a0d7b742e5cc47545356d2910..bad01dd3dc0fa097431b928e877480490283ee52 100644 (file)
@@ -4,6 +4,14 @@ require "oauth/rack/oauth_filter"
 Rails.configuration.middleware.use OAuth::Rack::OAuthFilter
 
 module OAuth
+  module Helper
+    def escape(value)
+      value.to_s.gsub(OAuth::RESERVED_CHARACTERS) do |c|
+        format("%%%02X", c.ord)
+      end
+    end
+  end
+
   module RequestProxy
     class RackRequest
       def method
@@ -35,12 +43,12 @@ module OpenStreetMap
     module ClassMethods
       def included(controller)
         controller.class_eval do
-          def self.before_filter(...)
-            before_action(...)
+          def self.before_filter(*names, &blk)
+            before_action(*names, &blk)
           end
 
-          def self.skip_before_filter(...)
-            skip_before_action(...)
+          def self.skip_before_filter(*names, &blk)
+            skip_before_action(*names, &blk)
           end
         end