diff options
author | Joey Butler <Joey.butler@livingsocial.com> | 2012-12-03 23:30:10 -0500 |
---|---|---|
committer | Joey Butler <Joey.butler@livingsocial.com> | 2012-12-05 07:59:08 -0500 |
commit | 542d525064e20b2d83b1ad465aa87aa335286452 (patch) | |
tree | 16bb03e19cdc0fd929c5c7b81a220b0eb9ccb004 /actionpack | |
parent | c7e4ee79326d81f78cfa3d958a8fce34fde83a15 (diff) | |
download | rails-542d525064e20b2d83b1ad465aa87aa335286452.tar.gz rails-542d525064e20b2d83b1ad465aa87aa335286452.tar.bz2 rails-542d525064e20b2d83b1ad465aa87aa335286452.zip |
Extract method refactoring in ActionDispatch::Routing::SingletonResource.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 0c19b493ab..8336f1fb4b 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1052,15 +1052,7 @@ module ActionDispatch get :new end if parent_resource.actions.include?(:new) - member do - get :edit if parent_resource.actions.include?(:edit) - get :show if parent_resource.actions.include?(:show) - if parent_resource.actions.include?(:update) - patch :update - put :update - end - delete :destroy if parent_resource.actions.include?(:destroy) - end + set_member_mappings_for_resource end self @@ -1219,15 +1211,7 @@ module ActionDispatch get :new end if parent_resource.actions.include?(:new) - member do - get :edit if parent_resource.actions.include?(:edit) - get :show if parent_resource.actions.include?(:show) - if parent_resource.actions.include?(:update) - patch :update - put :update - end - delete :destroy if parent_resource.actions.include?(:destroy) - end + set_member_mappings_for_resource end self @@ -1578,6 +1562,18 @@ module ActionDispatch end end end + + def set_member_mappings_for_resource + member do + get :edit if parent_resource.actions.include?(:edit) + get :show if parent_resource.actions.include?(:show) + if parent_resource.actions.include?(:update) + patch :update + put :update + end + delete :destroy if parent_resource.actions.include?(:destroy) + end + end end # Routing Concerns allow you to declare common routes that can be reused |