aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/routing/segments.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-05-11 23:50:08 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-05-11 23:50:08 +0100
commitcb50a2880759f311148abda55ab60be772b8aa51 (patch)
tree3f8f851f332c0976349de9dc2b4a722946b4cc5e /actionpack/lib/action_controller/routing/segments.rb
parent35634feb474cc55fbc95edeffe98cec241d45f23 (diff)
parent9a137506a1267ec5938fcec4d2ff135f15037459 (diff)
downloadrails-cb50a2880759f311148abda55ab60be772b8aa51.tar.gz
rails-cb50a2880759f311148abda55ab60be772b8aa51.tar.bz2
rails-cb50a2880759f311148abda55ab60be772b8aa51.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/lib/action_controller/routing/segments.rb')
-rw-r--r--actionpack/lib/action_controller/routing/segments.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/routing/segments.rb b/actionpack/lib/action_controller/routing/segments.rb
index 24ea8c7f2d..b142d18b47 100644
--- a/actionpack/lib/action_controller/routing/segments.rb
+++ b/actionpack/lib/action_controller/routing/segments.rb
@@ -244,11 +244,12 @@ module ActionController
end
class PathSegment < DynamicSegment #:nodoc:
- RESERVED_PCHAR = "#{Segment::RESERVED_PCHAR}/"
- UNSAFE_PCHAR = Regexp.new("[^#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}]", false, 'N').freeze
-
def interpolation_chunk(value_code = "#{local_name}")
- "\#{URI.escape(#{value_code}.to_s, ActionController::Routing::PathSegment::UNSAFE_PCHAR)}"
+ "\#{#{value_code}}"
+ end
+
+ def extract_value
+ "#{local_name} = hash[:#{key}] && hash[:#{key}].collect { |path_component| URI.escape(path_component, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}"
end
def default