diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2010-06-18 18:25:07 +0200 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-06-18 13:59:14 -0700 |
commit | 9d3eeb905341aaad942ceb0e47bd04cced34d031 (patch) | |
tree | 16d644a9b1352ff9d9903f69e705af74ceae5985 /actionpack/lib | |
parent | a55d83292f9dbc34368e3cb91d99eb5b4aa4fa78 (diff) | |
download | rails-9d3eeb905341aaad942ceb0e47bd04cced34d031.tar.gz rails-9d3eeb905341aaad942ceb0e47bd04cced34d031.tar.bz2 rails-9d3eeb905341aaad942ceb0e47bd04cced34d031.zip |
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 <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 7 |
1 files changed, 3 insertions, 4 deletions
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 |