aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2013-01-21 17:20:51 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2013-01-21 17:20:51 +0000
commit431759614d84395faa713ebdfa8bd1cadc97183a (patch)
treeedc38739164010569f5e45183ee47006352dadd7 /actionpack/lib/action_dispatch
parenta3aca81b21f793e8869440e9e84ead80c2479e3d (diff)
downloadrails-431759614d84395faa713ebdfa8bd1cadc97183a.tar.gz
rails-431759614d84395faa713ebdfa8bd1cadc97183a.tar.bz2
rails-431759614d84395faa713ebdfa8bd1cadc97183a.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/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb5
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 9a474d2e3a..0b71c2ea5c 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -1288,9 +1288,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