From 7353fc15957aa3b32eae8cf495701a7163cf8dbc Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 9 Apr 2010 23:09:15 -0700 Subject: Dial back from 'namespace :controller => ...' to 'scope :module => ...' --- actionpack/lib/action_dispatch/routing/mapper.rb | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'actionpack/lib/action_dispatch') 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) -- cgit v1.2.3