diff options
Diffstat (limited to 'actionpack/lib')
-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 |