aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/routing
diff options
context:
space:
mode:
authorCody Fauser <cody@jadedpixel.com>2008-05-14 09:11:35 -0400
committerCody Fauser <cody@jadedpixel.com>2008-05-14 09:11:35 -0400
commit9226b3e8355e7b6aa3be62fff56117d75c408831 (patch)
tree2952484a50583e4c438d0abb37ff549e6c9811dc /actionpack/lib/action_controller/routing
parentb8c46c86f0b785f6afc3c58eeb1b347543f5901e (diff)
parent9546ee299952c86329c4854f9b3776382c0575ff (diff)
downloadrails-9226b3e8355e7b6aa3be62fff56117d75c408831.tar.gz
rails-9226b3e8355e7b6aa3be62fff56117d75c408831.tar.bz2
rails-9226b3e8355e7b6aa3be62fff56117d75c408831.zip
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'actionpack/lib/action_controller/routing')
-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