diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-05 05:05:40 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-05 05:05:40 -0800 |
commit | 1b32c06b99c7df5715d0fb47afc7edc4a7abd769 (patch) | |
tree | febefce13a5138fda286f56f5ed7d50228f792b7 /actionpack/lib | |
parent | e905639af2fe947ff7e1e2331e9216032dff8b3e (diff) | |
parent | 542d525064e20b2d83b1ad465aa87aa335286452 (diff) | |
download | rails-1b32c06b99c7df5715d0fb47afc7edc4a7abd769.tar.gz rails-1b32c06b99c7df5715d0fb47afc7edc4a7abd769.tar.bz2 rails-1b32c06b99c7df5715d0fb47afc7edc4a7abd769.zip |
Merge pull request #8412 from JoeyButler/action_dispatch_routing_mapper_refactoring
Extract method refactoring.
Diffstat (limited to 'actionpack/lib')
-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 55e4561e8e..3c99932e72 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1048,15 +1048,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 @@ -1215,15 +1207,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 @@ -1574,6 +1558,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 |