Sha256: 7cbf844f80592034bf8854525a07c8172dd552bb87e82c313bbac0c13a3d089f

Contents?: true

Size: 873 Bytes

Versions: 18

Compression:

Stored size: 873 Bytes

Contents

module ActionDispatch
  module Routing
    class RoutesProxy #:nodoc:
      include ActionDispatch::Routing::UrlFor

      attr_accessor :scope, :routes
      alias :_routes :routes

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

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

      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
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
actionpack-3.2.0.rc1 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.3 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.2 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.2.rc2 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.2.rc1 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.1 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.1.rc3 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.1.rc2 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.1.rc1 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.rc8 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.rc6 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.rc5 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.rc4 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.rc3 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.rc2 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.rc1 lib/action_dispatch/routing/routes_proxy.rb
actionpack-3.1.0.beta1 lib/action_dispatch/routing/routes_proxy.rb