diff --git a/actionpack/lib/action_controller/routing/segments.rb b/actionpack/lib/action_controller/routing/segments.rb index 9d4b740a441ad84cf6871a25c4326b920c9147a5..e5f174ae2c6c0f3895c0617fcfac17a45aa6fedf 100644 --- a/actionpack/lib/action_controller/routing/segments.rb +++ b/actionpack/lib/action_controller/routing/segments.rb @@ -160,7 +160,7 @@ def extraction_code s << "\n#{expiry_statement}" end - def interpolation_chunk(value_code = "#{local_name}") + def interpolation_chunk(value_code = local_name) "\#{URI.escape(#{value_code}.to_s, ActionController::Routing::Segment::UNSAFE_PCHAR)}" end @@ -231,7 +231,7 @@ def regexp_chunk end # Don't URI.escape the controller name since it may contain slashes. - def interpolation_chunk(value_code = "#{local_name}") + def interpolation_chunk(value_code = local_name) "\#{#{value_code}.to_s}" end @@ -251,7 +251,7 @@ def match_extraction(next_capture) end class PathSegment < DynamicSegment #:nodoc: - def interpolation_chunk(value_code = "#{local_name}") + def interpolation_chunk(value_code = local_name) "\#{#{value_code}}" end