diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-08 21:06:26 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-08 21:06:26 +0100 |
commit | 7942e909608f24db0365943c5d9ad51cbb4d27b5 (patch) | |
tree | 6a9b51155b9220dbf98d4b1c78d8edccabd231c5 /actionpack/lib/action_dispatch/routing/mapper.rb | |
parent | 36eb1a686c831d5a14998bb9ac7cc60efa363373 (diff) | |
parent | ae93789d9ad9095ca21784287464b760db12a095 (diff) | |
download | rails-7942e909608f24db0365943c5d9ad51cbb4d27b5.tar.gz rails-7942e909608f24db0365943c5d9ad51cbb4d27b5.tar.bz2 rails-7942e909608f24db0365943c5d9ad51cbb4d27b5.zip |
Merge master.
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 52e7b0e77d..7a33259054 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1,3 +1,5 @@ +require "active_support/core_ext/hash/except" + module ActionDispatch module Routing class Mapper @@ -85,7 +87,7 @@ module ActionDispatch end def requirements - @requirements ||= returning(@options[:constraints] || {}) do |requirements| + @requirements ||= (@options[:constraints] || {}).tap do |requirements| requirements.reverse_merge!(@scope[:constraints]) if @scope[:constraints] @options.each { |k, v| requirements[k] = v if v.is_a?(Regexp) } end @@ -450,7 +452,10 @@ module ActionDispatch scope(:path => resource.name.to_s, :controller => resource.controller) do with_scope_level(:resource, resource) do - yield if block_given? + + scope(:name_prefix => resource.name.to_s) do + yield if block_given? + end get :show if resource.actions.include?(:show) post :create if resource.actions.include?(:create) |