From f26ae7d10f9b890a9ac5de70f0be4a9cf9149233 Mon Sep 17 00:00:00 2001 From: Xavier Shay Date: Sun, 7 Jul 2013 14:23:36 -0700 Subject: Move `controller_reference` and `controller_class_names` to protected scope so that they are available to subclasses. --- actionpack/lib/action_dispatch/routing/route_set.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index c9775a40b7..e885bfa770 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -62,13 +62,17 @@ module ActionDispatch raise ActionController::RoutingError, e.message, e.backtrace if default_controller end - private + protected + + attr_reader :controller_class_names def controller_reference(controller_param) - const_name = @controller_class_names[controller_param] ||= "#{controller_param.camelize}Controller" + const_name = controller_class_names[controller_param] ||= "#{controller_param.camelize}Controller" ActiveSupport::Dependencies.constantize(const_name) end + private + def dispatch(controller, action, req) controller.action(action).call(req.env) end -- cgit v1.2.3 From 2992b1c04c555c6483245257eab16026dd0fd889 Mon Sep 17 00:00:00 2001 From: Xavier Shay Date: Sun, 7 Jul 2013 14:34:46 -0700 Subject: Allow a custom dispatcher to be provided to routing. --- actionpack/lib/action_dispatch/routing/route_set.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index e885bfa770..a8fb5aade3 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -317,7 +317,7 @@ module ActionDispatch attr_accessor :formatter, :set, :named_routes, :default_scope, :router attr_accessor :disable_clear_and_finalize, :resources_path_names - attr_accessor :default_url_options + attr_accessor :default_url_options, :dispatcher_class attr_reader :env_key alias :routes :set @@ -360,6 +360,7 @@ module ActionDispatch @set = Journey::Routes.new @router = Journey::Router.new @set @formatter = Journey::Formatter.new @set + @dispatcher_class = Routing::RouteSet::Dispatcher end def relative_url_root @@ -418,7 +419,7 @@ module ActionDispatch end def dispatcher(defaults) - Routing::RouteSet::Dispatcher.new(defaults) + dispatcher_class.new(defaults) end module MountedHelpers -- cgit v1.2.3