diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-01-21 17:05:49 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-01-21 17:14:10 +0000 |
commit | c4106d0c08954b0761726e0015ec601b7bc7ea4b (patch) | |
tree | 97d44edf9f4c9a6351eb6933d78dc1c0cf981c41 /actionpack/lib | |
parent | 4e327225947b933d5434509e02e98226c581adc1 (diff) | |
download | rails-c4106d0c08954b0761726e0015ec601b7bc7ea4b.tar.gz rails-c4106d0c08954b0761726e0015ec601b7bc7ea4b.tar.bz2 rails-c4106d0c08954b0761726e0015ec601b7bc7ea4b.zip |
Duplicate possible frozen string from route
Ruby 1.9 freezes Hash string keys by default so where a route is
defined like this:
get 'search' => 'search'
then the Mapper will derive the action from the key. This blows up
later when the action is added to the parameters hash and the
encoding is forced.
Closes #3429
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 6d93f609a6..3a86432622 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1403,9 +1403,10 @@ module ActionDispatch def add_route(action, options) # :nodoc: path = path_for_action(action, options.delete(:path)) + action = action.to_s.dup - if action.to_s =~ /^[\w\/]+$/ - options[:action] ||= action unless action.to_s.include?("/") + if action =~ /^[\w\/]+$/ + options[:action] ||= action unless action.include?("/") else action = nil end |