提交 203b88f9 编写于 作者: K kennyj

Fix GH #4720. Routing problem with nested namespace and already camelized controller option.

上级 e6c98b83
......@@ -31,6 +31,7 @@ def call(env)
end
def prepare_params!(params)
normalize_controller!(params)
merge_default_action!(params)
split_glob_param!(params) if @glob_param
end
......@@ -66,6 +67,10 @@ def dispatch(controller, action, env)
controller.action(action).call(env)
end
def normalize_controller!(params)
params[:controller] = params[:controller].underscore if params.key?(:controller)
end
def merge_default_action!(params)
params[:action] ||= 'index'
end
......
......@@ -2449,6 +2449,32 @@ def test_missing_routes_are_still_missing
end
end
class TestNamespaceWithControllerOption < ActionDispatch::IntegrationTest
module ::Admin
class StorageFilesController < ActionController::Base
def index
render :text => "admin/storage_files#index"
end
end
end
DefaultScopeRoutes = ActionDispatch::Routing::RouteSet.new
DefaultScopeRoutes.draw do
namespace :admin do
resources :storage_files, :controller => "StorageFiles"
end
end
def app
DefaultScopeRoutes
end
def test_controller_options
get '/admin/storage_files'
assert_equal "admin/storage_files#index", @response.body
end
end
class TestDefaultScope < ActionDispatch::IntegrationTest
module ::Blog
class PostsController < ActionController::Base
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册