Permalink
Browse files

Don't force pluralization of controller name when defining a resource [

…#4980 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent bba1960 commit 9a6fc9a540cd23af3ca061cb7406a6cdd5ad4294 @pixeltrix pixeltrix committed with josevalim Jun 26, 2010
Showing with 18 additions and 1 deletion.
  1. +9 −1 actionpack/lib/action_dispatch/routing/mapper.rb
  2. +9 −0 actionpack/test/dispatch/routing_test.rb
@@ -443,7 +443,7 @@ def self.default_actions
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 @@ def self.default_actions
[: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 @@ def self.matches?(request)
end
end
+ resources :content
+
match '/:locale/*file.:format', :to => 'files#show', :file => /path\/to\/existing\/file/
end
end
@@ -1457,6 +1459,13 @@ def test_glob_parameter_accepts_regexp
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

0 comments on commit 9a6fc9a

Please sign in to comment.