class ActionDispatch::Routing::RoutesProxy

:nodoc:

def initialize(routes, scope)

def initialize(routes, scope)
  @routes, @scope = routes, scope
end

def method_missing(method, *args)

def method_missing(method, *args)
  if routes.url_helpers.respond_to?(method)
    self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
      def #{method}(*args)
        options = args.extract_options!
        args << url_options.merge((options || {}).symbolize_keys)
        routes.url_helpers.#{method}(*args)
      end
    RUBY
    send(method, *args)
  else
    super
  end
end

def respond_to?(method, include_private = false)

def respond_to?(method, include_private = false)
  super || routes.url_helpers.respond_to?(method)
end

def url_options

def url_options
  scope.send(:_with_routes, routes) do
    scope.url_options
  end
end