diff options
author | Gabe da Silveira <gabe@websaviour.com> | 2008-11-14 01:14:02 -0800 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-11-18 22:47:33 +0100 |
commit | 917428bcce7bb22241bfc07daa5d0ddf9d107775 (patch) | |
tree | 9deaed010588026d1f7ee4dd93b4401ed26c7b20 /actionpack/lib | |
parent | 60d6f255177af3ca93721abb8551c8585fc8c67d (diff) | |
download | rails-917428bcce7bb22241bfc07daa5d0ddf9d107775.tar.gz rails-917428bcce7bb22241bfc07daa5d0ddf9d107775.tar.bz2 rails-917428bcce7bb22241bfc07daa5d0ddf9d107775.zip |
Make optimized named routes respect all reserved options and tie it into UrlRewriter::RESERVED_OPTIONS so it's DRY
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/routing/optimisations.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_controller/routing/route_set.rb | 1 |
2 files changed, 3 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/routing/optimisations.rb b/actionpack/lib/action_controller/routing/optimisations.rb index 0a87303bda..4522ebcb1a 100644 --- a/actionpack/lib/action_controller/routing/optimisations.rb +++ b/actionpack/lib/action_controller/routing/optimisations.rb @@ -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, diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb index ff448490e9..1b8b52ad10 100644 --- a/actionpack/lib/action_controller/routing/route_set.rb +++ b/actionpack/lib/action_controller/routing/route_set.rb @@ -168,6 +168,7 @@ module ActionController # @module.module_eval <<-end_eval # We use module_eval to avoid leaks def #{selector}(*args) + #{generate_optimisation_block(route, kind)} opts = if args.empty? || Hash === args.first |