From fef6c32afe2276dffa0347e25808a86e7a101af1 Mon Sep 17 00:00:00 2001 From: Aaron Batalion Date: Mon, 24 Nov 2008 02:24:19 -0500 Subject: Added optimal formatted routes to rails, deprecating the formatted_* methods, and reducing routes creation by 50% [#1359 state:committed] Signed-off-by: David Heinemeier Hansson --- actionpack/lib/action_controller/routing/route.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'actionpack/lib/action_controller/routing/route.rb') diff --git a/actionpack/lib/action_controller/routing/route.rb b/actionpack/lib/action_controller/routing/route.rb index a610ec7e84..e4dfdb1718 100644 --- a/actionpack/lib/action_controller/routing/route.rb +++ b/actionpack/lib/action_controller/routing/route.rb @@ -35,6 +35,11 @@ module ActionController segment.key if segment.respond_to? :key end.compact end + + def required_segment_keys + required_segments = segments.select {|seg| (!seg.optional? && !seg.is_a?(DividerSegment)) || seg.is_a?(PathSegment) } + required_segments.collect { |seg| seg.key if seg.respond_to?(:key)}.compact + end # Build a query string from the keys of the given hash. If +only_keys+ # is given (as an array), only the keys indicated will be used to build -- cgit v1.2.3