diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-04-09 23:09:15 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-04-09 23:09:15 -0700 |
commit | 7353fc15957aa3b32eae8cf495701a7163cf8dbc (patch) | |
tree | 5e312a5f685b5ad5628e84ddf137a6a3af7cacb7 /actionpack/lib/action_dispatch/routing | |
parent | 561d9eff0c5702c449a2a0117ad9950ad8842dc2 (diff) | |
download | rails-7353fc15957aa3b32eae8cf495701a7163cf8dbc.tar.gz rails-7353fc15957aa3b32eae8cf495701a7163cf8dbc.tar.bz2 rails-7353fc15957aa3b32eae8cf495701a7163cf8dbc.zip |
Dial back from 'namespace :controller => ...' to 'scope :module => ...'
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index bf707f354a..61256e8df1 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -323,21 +323,9 @@ module ActionDispatch scope(controller.to_sym) { yield } end - def namespace(path_or_options) - options = - case path_or_options - when String, Symbol - path = path_or_options.to_s - { :path => path, - :name_prefix => path, - :controller_namespace => path } - when Hash - { :path => path_or_options[:path], - :controller_namespace => path_or_options[:controller] } - else - raise ArgumentError, "Unknown namespace: #{path_or_options.inspect}" - end - scope(options) { yield } + def namespace(path) + path = path.to_s + scope(:path => path, :name_prefix => path, :module => path) { yield } end def constraints(constraints = {}) @@ -376,12 +364,12 @@ module ActionDispatch parent ? "#{parent}_#{child}" : child end - def merge_controller_namespace_scope(parent, child) + def merge_module_scope(parent, child) parent ? "#{parent}/#{child}" : child end def merge_controller_scope(parent, child) - @scope[:controller_namespace] ? "#{@scope[:controller_namespace]}/#{child}" : child + @scope[:module] ? "#{@scope[:module]}/#{child}" : child end def merge_resources_path_names_scope(parent, child) |