diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-09-28 20:57:39 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-09-28 20:57:39 +0000 |
commit | 9660360d6b48574c558110758be1e42c01333343 (patch) | |
tree | ded91e9b871798a006bd919485f53843ee95fcae /actionpack/lib | |
parent | 8c33359ce8531df65a03c21631232024c0868bf8 (diff) | |
download | rails-9660360d6b48574c558110758be1e42c01333343.tar.gz rails-9660360d6b48574c558110758be1e42c01333343.tar.bz2 rails-9660360d6b48574c558110758be1e42c01333343.zip |
Re-enable Routing optimisation code for _url methods, add defined?(request) to the guard conditions
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7673 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/routing_optimisation.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/routing_optimisation.rb b/actionpack/lib/action_controller/routing_optimisation.rb index 71cfcbd935..b1bf3916d6 100644 --- a/actionpack/lib/action_controller/routing_optimisation.rb +++ b/actionpack/lib/action_controller/routing_optimisation.rb @@ -44,7 +44,7 @@ module ActionController # Temporarily disabled :url optimisation pending proper solution to # Issues around request.host etc. def applicable? - kind != :url + true end end @@ -60,9 +60,9 @@ module ActionController # 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 - "args.size == 1 && !args.first.is_a?(Hash)" + "defined?(request) && args.size == 1 && !args.first.is_a?(Hash)" else - "args.size == #{number_of_arguments}" + "defined?(request) && args.size == #{number_of_arguments}" end end @@ -97,7 +97,7 @@ module ActionController # argument class PositionalArgumentsWithAdditionalParams < PositionalArguments def guard_condition - "args.size == #{route.segment_keys.size + 1}" + "defined?(request) && args.size == #{route.segment_keys.size + 1}" end # This case uses almost the Use the same code as positional arguments, diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index 7aae619681..c650763fdb 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -21,13 +21,9 @@ module ActionController self.default_url_options = {} def self.included(base) #:nodoc: - original_optimise = ActionController::Routing.optimise_named_routes - ActionController::Routing.optimise_named_routes = false - ActionController::Routing::Routes.install_helpers base, :regenerate + ActionController::Routing::Routes.install_helpers base base.mattr_accessor :default_url_options base.default_url_options ||= default_url_options - ensure - ActionController::Routing.optimise_named_routes = original_optimise end # Generate a url based on the options provided, default_url_options and the |