diff options
author | Dave Rogers <david.t.rogers@gmail.com> | 2011-07-24 17:21:26 -0700 |
---|---|---|
committer | Dave Rogers <david.t.rogers@gmail.com> | 2011-07-25 09:59:53 -0700 |
commit | 4dc42f53539a5d1020c49dd61bad2276adc277bf (patch) | |
tree | 47b261fd9b708e83c4f46d4acc33918398f89ecb /actionpack/lib | |
parent | 02691d3516e68b2de5545ec7a495024a377f89fc (diff) | |
download | rails-4dc42f53539a5d1020c49dd61bad2276adc277bf.tar.gz rails-4dc42f53539a5d1020c49dd61bad2276adc277bf.tar.bz2 rails-4dc42f53539a5d1020c49dd61bad2276adc277bf.zip |
Ensure the constraints block is only applied to the correct route
addresses issue #1907 - any routes that follow a route with a constraints
block are inheriting the previous route's constraints.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 8d071b2061..1331f67a78 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -190,13 +190,12 @@ module ActionDispatch end def blocks - block = @scope[:blocks] || [] - - if @options[:constraints].present? && !@options[:constraints].is_a?(Hash) - block << @options[:constraints] + constraints = @options[:constraints] + if constraints.present? && !constraints.is_a?(Hash) + [constraints] + else + @scope[:blocks] || [] end - - block end def constraints |