mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't force pluralization of controller name when defining a resource [#4980 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
bba19603c2
commit
9a6fc9a540
2 changed files with 18 additions and 1 deletions
|
@ -443,7 +443,7 @@ module ActionDispatch
|
|||
def initialize(entities, options = {})
|
||||
@name = entities.to_s
|
||||
@path = options.delete(:path) || @name
|
||||
@controller = options.delete(:controller) || @name.to_s.pluralize
|
||||
@controller = (options.delete(:controller) || @name).to_s
|
||||
@as = options.delete(:as)
|
||||
@options = options
|
||||
end
|
||||
|
@ -547,6 +547,14 @@ module ActionDispatch
|
|||
[:show, :create, :update, :destroy, :new, :edit]
|
||||
end
|
||||
|
||||
def initialize(entities, options)
|
||||
@name = entities.to_s
|
||||
@path = options.delete(:path) || @name
|
||||
@controller = (options.delete(:controller) || @name.to_s.pluralize).to_s
|
||||
@as = options.delete(:as)
|
||||
@options = options
|
||||
end
|
||||
|
||||
def member_name
|
||||
name
|
||||
end
|
||||
|
|
|
@ -318,6 +318,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
|
|||
end
|
||||
end
|
||||
|
||||
resources :content
|
||||
|
||||
match '/:locale/*file.:format', :to => 'files#show', :file => /path\/to\/existing\/file/
|
||||
end
|
||||
end
|
||||
|
@ -1457,6 +1459,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
|
|||
end
|
||||
end
|
||||
|
||||
def test_resources_controller_name_is_not_pluralized
|
||||
with_test_routes do
|
||||
get '/content'
|
||||
assert_equal 'content#index', @response.body
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def with_test_routes
|
||||
yield
|
||||
|
|
Loading…
Reference in a new issue