Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a warning: ActionController::Dispatcher.before_dispatch is depr…

…ecated.
  • Loading branch information...
commit 712d62497c8853794d1e1229ecd80b6dacd0d575 1 parent b8328b8
@nengxu authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/proxy.rb
View
13 lib/proxy.rb
@@ -7,13 +7,13 @@
module Proxy
mattr_accessor :replace_host_with_proc
self.replace_host_with_proc = proc { |request| }
-
+
def self.replace_host_with(&block)
self.replace_host_with_proc = block
end
-
+
private
-
+
def self.before_dispatch(dispatcher)
request = dispatcher.instance_variable_get('@request') || dispatcher.instance_variable_get('@env')
request = Rack::Request.new(request) if request.is_a?(Hash)
@@ -22,7 +22,7 @@ def self.before_dispatch(dispatcher)
end
end
-ActionController::Dispatcher.before_dispatch do |dispatcher|
+ActionDispatch::Callbacks.before do |dispatcher|
Proxy.send :before_dispatch, dispatcher
end
@@ -36,14 +36,15 @@ def self.before_dispatch(dispatcher)
unless ActionController::UrlWriter.respond_to?(:default_url_options)
ActionController::Base.class_eval do
include ActionController::UrlWriter
-
+
def default_url_options_with_backwards_compatibility(*args)
default_url_options_without_backwards_compatibility
end
alias_method_chain :default_url_options, :backwards_compatibility
end
-
+
class << ActionController::UrlWriter
delegate :default_url_options, :default_url_options=, :to => ::ActionController::Base
end
end
+
Please sign in to comment.
Something went wrong with that request. Please try again.