From 0adf4a97c1f29a7230e00d39c04c8b4a6053fa65 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 27 Apr 2007 05:06:38 +0000 Subject: Actually make the name_prefix work like the previous checkin said it would git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6590 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/resources.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/resources.rb b/actionpack/lib/action_controller/resources.rb index 498ab44746..65755d247a 100644 --- a/actionpack/lib/action_controller/resources.rb +++ b/actionpack/lib/action_controller/resources.rb @@ -44,6 +44,11 @@ module ActionController @nesting_path_prefix ||= "#{path}/:#{singular}_id" end + def nesting_name_prefix + "#{singular}_" + end + + protected def arrange_actions @collection_methods = arrange_actions_by_methods(options.delete(:collection)) @@ -309,7 +314,7 @@ module ActionController map_associations(resource, options) if block_given? - with_options(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.name_prefix, &block) + with_options(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, &block) end end end @@ -326,18 +331,18 @@ module ActionController map_associations(resource, options) if block_given? - with_options(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.name_prefix, &block) + with_options(:path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix, &block) end end end def map_associations(resource, options) Array(options[:has_many]).each do |association| - resources(association, :path_prefix => resource.nesting_path_prefix, :name_prefix => resource.name_prefix) + resources(association, :path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix) end Array(options[:has_one]).each do |association| - resource(association, :path_prefix => resource.nesting_path_prefix, :name_prefix => resource.name_prefix) + resource(association, :path_prefix => resource.nesting_path_prefix, :name_prefix => resource.nesting_name_prefix) end end -- cgit v1.2.3