Permalink
Browse files

Move RoutesProxy to separate file

  • Loading branch information...
1 parent e35c204 commit b1c66f060bba22d16abf6d24d3df762c240e367c @drogus drogus committed Aug 25, 2010
@@ -268,6 +268,7 @@ module Routing
autoload :Mapper, 'action_dispatch/routing/mapper'
autoload :Route, 'action_dispatch/routing/route'
autoload :RouteSet, 'action_dispatch/routing/route_set'
+ autoload :RoutesProxy, 'action_dispatch/routing/routes_proxy'
autoload :UrlFor, 'action_dispatch/routing/url_for'
autoload :PolymorphicRoutes, 'action_dispatch/routing/polymorphic_routes'
@@ -261,38 +261,6 @@ def install_helpers(destinations = [ActionController::Base, ActionView::Base], r
named_routes.install(destinations, regenerate_code)
end
- class RoutesProxy
- 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
-
module MountedHelpers
end
@@ -0,0 +1,35 @@
+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

0 comments on commit b1c66f0

Please sign in to comment.