From 9d3eeb905341aaad942ceb0e47bd04cced34d031 Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Fri, 18 Jun 2010 18:25:07 +0200 Subject: fix for :shallow in router not generating helpers for create, update, and destroy actions when :only or :except are used [#4900 state:committed] Signed-off-by: Jeremy Kemper --- actionpack/lib/action_dispatch/routing/mapper.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 46304b0336..95e56566a3 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -536,6 +536,7 @@ module ActionDispatch def member_name name end + alias_method :collection_name, :member_name def nested_path path @@ -874,9 +875,9 @@ module ActionDispatch shallow_prefix = @scope[:module].blank? ? "" : "#{@scope[:module].tr('/', '_')}_" case action - when :index + when :index, :create "#{name_prefix}#{parent_resource.collection_name}" - when :show + when :show, :update, :destroy if parent_resource.shallow? "#{shallow_prefix}#{parent_resource.member_name}" else @@ -890,8 +891,6 @@ module ActionDispatch end when :new "new_#{name_prefix}#{parent_resource.member_name}" - when :update, :create, :destroy - nil else case @scope[:scope_level] when :collection -- cgit v1.2.3