aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb5
-rw-r--r--actionpack/test/dispatch/routing_test.rb7
2 files changed, 10 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
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 46d16598f7..6ecf011694 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -515,6 +515,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
match '/sculptors', :to => 'italians#sculptors'
match '/painters/:painter', :to => 'italians#painters', :constraints => {:painter => /michelangelo/}
end
+
+ get 'search' => 'search'
end
end
@@ -2477,6 +2479,11 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal "/posts/1/admin", post_admin_root_path(:post_id => '1')
end
+ def test_action_from_path_is_not_frozen
+ get '/search'
+ assert !@request.params[:action].frozen?
+ end
+
private
def with_test_routes
yield