diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-27 05:06:38 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-27 05:06:38 +0000 |
commit | 0adf4a97c1f29a7230e00d39c04c8b4a6053fa65 (patch) | |
tree | e727442dd33ee7a34c56278d60ff73bfcfc098ff /actionpack/lib/action_controller | |
parent | 63aea3ffa9897e748ff03dd119605453d518ac3f (diff) | |
download | rails-0adf4a97c1f29a7230e00d39c04c8b4a6053fa65.tar.gz rails-0adf4a97c1f29a7230e00d39c04c8b4a6053fa65.tar.bz2 rails-0adf4a97c1f29a7230e00d39c04c8b4a6053fa65.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/resources.rb | 13 |
1 files changed, 9 insertions, 4 deletions
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 |