diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-08 16:13:00 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-08 16:13:00 -0600 |
commit | ce5f27b04b1ff25eed520a3d06b3b9c150536e21 (patch) | |
tree | afd767b78398a8b95e0148865dead6a21e19ef50 /actionpack/lib/action_dispatch/routing | |
parent | c4df6332a4d8292dd7d6bd6a1badc896a2323d11 (diff) | |
download | rails-ce5f27b04b1ff25eed520a3d06b3b9c150536e21.tar.gz rails-ce5f27b04b1ff25eed520a3d06b3b9c150536e21.tar.bz2 rails-ce5f27b04b1ff25eed520a3d06b3b9c150536e21.zip |
Remove double scoping blocks and just use one
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 24b04088e6..8cb7745aff 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -297,18 +297,16 @@ module ActionDispatch return self end - controller(resource.controller) do - namespace(resource.name) do - with_scope_level(:resource, resource) do - yield if block_given? - - get "", :to => :show, :as => resource.member_name - post "", :to => :create - put "", :to => :update - delete "", :to => :destroy - get "new", :to => :new, :as => "new_#{resource.singular}" - get "edit", :to => :edit, :as => "edit_#{resource.singular}" - end + scope(:path => resource.name, :controller => resource.controller) do + with_scope_level(:resource, resource) do + yield if block_given? + + get "", :to => :show, :as => resource.member_name + post "", :to => :create + put "", :to => :update + delete "", :to => :destroy + get "new", :to => :new, :as => "new_#{resource.singular}" + get "edit", :to => :edit, :as => "edit_#{resource.singular}" end end @@ -333,24 +331,22 @@ module ActionDispatch return self end - controller(resource.controller) do - namespace(resource.name) do - with_scope_level(:resources, resource) do - yield if block_given? + scope(:path => resource.name, :controller => resource.controller) do + with_scope_level(:resources, resource) do + yield if block_given? - with_scope_level(:collection) do - get "", :to => :index, :as => resource.collection_name - post "", :to => :create - get "new", :to => :new, :as => "new_#{resource.singular}" - end + with_scope_level(:collection) do + get "", :to => :index, :as => resource.collection_name + post "", :to => :create + get "new", :to => :new, :as => "new_#{resource.singular}" + end - with_scope_level(:member) do - scope(":id") do - get "", :to => :show, :as => resource.member_name - put "", :to => :update - delete "", :to => :destroy - get "edit", :to => :edit, :as => "edit_#{resource.singular}" - end + with_scope_level(:member) do + scope(":id") do + get "", :to => :show, :as => resource.member_name + put "", :to => :update + delete "", :to => :destroy + get "edit", :to => :edit, :as => "edit_#{resource.singular}" end end end |