aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/routing/optimisations.rb
diff options
context:
space:
mode:
authorHongli Lai (Phusion) <hongli@phusion.nl>2008-12-03 19:30:35 +0100
committerHongli Lai (Phusion) <hongli@phusion.nl>2008-12-03 19:30:35 +0100
commitccb96f2297e8783165cba764e9b5d51e1a15ff87 (patch)
tree3229e6fdddc42054615514d843c555e341003033 /actionpack/lib/action_controller/routing/optimisations.rb
parentfb2325e35855d62abd2c76ce03feaa3ca7992e4f (diff)
parent761a633a9c0a45d76ef3ed10da97e3696c3ded79 (diff)
downloadrails-ccb96f2297e8783165cba764e9b5d51e1a15ff87.tar.gz
rails-ccb96f2297e8783165cba764e9b5d51e1a15ff87.tar.bz2
rails-ccb96f2297e8783165cba764e9b5d51e1a15ff87.zip
Merge commit 'origin/master' into savepoints
Conflicts: activerecord/lib/active_record/fixtures.rb activerecord/test/cases/defaults_test.rb
Diffstat (limited to 'actionpack/lib/action_controller/routing/optimisations.rb')
-rw-r--r--actionpack/lib/action_controller/routing/optimisations.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/routing/optimisations.rb b/actionpack/lib/action_controller/routing/optimisations.rb
index 0a87303bda..714cf97861 100644
--- a/actionpack/lib/action_controller/routing/optimisations.rb
+++ b/actionpack/lib/action_controller/routing/optimisations.rb
@@ -65,7 +65,7 @@ module ActionController
# rather than triggering the expensive logic in +url_for+.
class PositionalArguments < Optimiser
def guard_conditions
- number_of_arguments = route.segment_keys.size
+ number_of_arguments = route.required_segment_keys.size
# if they're using foo_url(:id=>2) it's one
# argument, but we don't want to generate /foos/id2
if number_of_arguments == 1
@@ -106,12 +106,8 @@ module ActionController
# argument
class PositionalArgumentsWithAdditionalParams < PositionalArguments
def guard_conditions
- [
- "args.size == #{route.segment_keys.size + 1}",
- "!args.last.has_key?(:anchor)",
- "!args.last.has_key?(:port)",
- "!args.last.has_key?(:host)"
- ]
+ ["args.size == #{route.segment_keys.size + 1}"] +
+ UrlRewriter::RESERVED_OPTIONS.collect{ |key| "!args.last.has_key?(:#{key})" }
end
# This case uses almost the same code as positional arguments,