diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2010-08-24 22:16:34 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-24 21:15:13 -0300 |
commit | 1847d33b4bc776fbd4746c06db41965744377ed6 (patch) | |
tree | 0de3f1d0c7b83aa8125a9af2735e39b05643f9e1 /actionpack/lib/action_dispatch | |
parent | 3ac6646d6f9ad978e8f245883b6227499785bf3e (diff) | |
download | rails-1847d33b4bc776fbd4746c06db41965744377ed6.tar.gz rails-1847d33b4bc776fbd4746c06db41965744377ed6.tar.bz2 rails-1847d33b4bc776fbd4746c06db41965744377ed6.zip |
Use nested scope for routes defined at the :resources scope level (as in Rails 2.3)
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 9aa34e7ba5..9a92ed0b62 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -695,15 +695,14 @@ module ActionDispatch raise ArgumentError, "Unknown scope #{on.inspect} given to :on" end - if @scope[:scope_level] == :resource + if @scope[:scope_level] == :resources + args.push(options) + return nested { match(*args) } + elsif @scope[:scope_level] == :resource args.push(options) return member { match(*args) } end - if resource_scope? - raise ArgumentError, "can't define route directly in resource(s) scope" - end - action = args.first path = path_for_action(action, options.delete(:path)) @@ -900,6 +899,8 @@ module ActionDispatch end name = case @scope[:scope_level] + when :nested + [member_name, prefix] when :collection [prefix, name_prefix, collection_name] when :new |