aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-11-29 18:17:14 -0600
committerJoshua Peek <josh@joshpeek.com>2009-11-29 18:17:14 -0600
commit075f50d62cd02c2cc14b145cdb34bc9ee85cc83c (patch)
tree42ab729300acf823aa29abbfc7b9f38f2f94741a /actionpack/lib/action_dispatch/routing
parentf69f9820ee84f32bb53d001efd6ebc79517fb0e1 (diff)
downloadrails-075f50d62cd02c2cc14b145cdb34bc9ee85cc83c.tar.gz
rails-075f50d62cd02c2cc14b145cdb34bc9ee85cc83c.tar.bz2
rails-075f50d62cd02c2cc14b145cdb34bc9ee85cc83c.zip
Fix some nested resource generation tests
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 8dfac30ac0..34d75e55b6 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -80,15 +80,19 @@ module ActionDispatch
resource = SingletonResource.new(resources.pop, :name_prefix => name_prefix)
if @scope[:scope_level] == :resources
- member do
- resource(resource.name, options, &block)
+ parent_resource = @scope[:scope_level_options][:name]
+ parent_named_prefix = @scope[:scope_level_options][:name_prefix]
+ with_scope_level(:member) do
+ scope(":#{parent_resource}_id", :name_prefix => parent_named_prefix) do
+ resource(resource.name, options, &block)
+ end
end
return self
end
controller(resource.controller) do
namespace(resource.name) do
- with_scope_level(:resource, :name => resource.singular) do
+ with_scope_level(:resource, :name => resource.singular, :name_prefix => resource.member_name) do
yield if block_given?
get "", :to => :show, :as => resource.member_name
@@ -118,8 +122,9 @@ module ActionDispatch
if @scope[:scope_level] == :resources
parent_resource = @scope[:scope_level_options][:name]
+ parent_named_prefix = @scope[:scope_level_options][:name_prefix]
with_scope_level(:member) do
- scope(":#{parent_resource}_id", :name_prefix => parent_resource) do
+ scope(":#{parent_resource}_id", :name_prefix => parent_named_prefix) do
resources(resource.name, options, &block)
end
end
@@ -128,7 +133,7 @@ module ActionDispatch
controller(resource.controller) do
namespace(resource.name) do
- with_scope_level(:resources, :name => resource.singular) do
+ with_scope_level(:resources, :name => resource.singular, :name_prefix => resource.member_name) do
yield if block_given?
collection do