Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Extract method refactoring. #8412

Merged
merged 1 commit into from

3 participants

@JoeyButler

Simple, straightforward refactoring complete with little green dots!

@steveklabnik
Collaborator

This commit message is extremely generic; can we get a better one, please?

@JoeyButler

@steveklabnik Updated, apologies for the slapdash commit message.

@rafaelfranca rafaelfranca merged commit 1b32c06 into from
@rafaelfranca
Owner

Thanks

@steveklabnik
Collaborator

It happens! I write lots of terrible messages myself. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2012
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 18 deletions.
  1. +14 −18 actionpack/lib/action_dispatch/routing/mapper.rb
View
32 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1052,15 +1052,7 @@ def resource(*resources, &block)
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 @@ def resources(*resources, &block)
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 @@ def name_for_action(as, action) #:nodoc:
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
Something went wrong with that request. Please try again.