diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 1f480eec73..1189111f20 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -67,6 +67,18 @@ module ActionDispatch end end + def controller_class + check_path_parameters! + params = path_parameters + controller_param = params[:controller].underscore if params.key?(:controller) + params[:action] ||= 'index' + + yield unless controller_param + + const_name = "#{controller_param.camelize}Controller" + ActiveSupport::Dependencies.constantize(const_name) + end + def key?(key) @env.key?(key) end |