aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/resources.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-05-22 09:37:07 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-05-22 09:37:07 +0000
commit5a3b4cf0bca5453547e89dc82966909b6bde3564 (patch)
treee9dcbdadd8ce7fdd1bd1f9a3ef63968575e221d5 /actionpack/lib/action_controller/resources.rb
parent4afd6c9f0a0e97429191af3e3b348ffa4416c640 (diff)
downloadrails-5a3b4cf0bca5453547e89dc82966909b6bde3564.tar.gz
rails-5a3b4cf0bca5453547e89dc82966909b6bde3564.tar.bz2
rails-5a3b4cf0bca5453547e89dc82966909b6bde3564.zip
Resource namespaces are inherited by their has_many subresources. Closes #8280.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6806 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/resources.rb')
-rw-r--r--actionpack/lib/action_controller/resources.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/resources.rb b/actionpack/lib/action_controller/resources.rb
index bb92684e5c..767d4c400a 100644
--- a/actionpack/lib/action_controller/resources.rb
+++ b/actionpack/lib/action_controller/resources.rb
@@ -375,12 +375,16 @@ module ActionController
end
def map_associations(resource, options)
+ path_prefix = "#{options.delete(:path_prefix)}#{resource.nesting_path_prefix}"
+ name_prefix = "#{options.delete(:name_prefix)}#{resource.nesting_name_prefix}"
+ namespace = options.delete(:namespace)
+
Array(options[:has_many]).each do |association|
- resources(association, :path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix)
+ resources(association, :path_prefix => path_prefix, :name_prefix => name_prefix, :namespace => namespace)
end
Array(options[:has_one]).each do |association|
- resource(association, :path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix)
+ resource(association, :path_prefix => path_prefix, :name_prefix => name_prefix, :namespace => namespace)
end
end