From 904df818d61b695a5f9508864137d13fffa22d15 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 3 Oct 2007 05:47:41 +0000 Subject: [PATCH] Move ActionController::Routing.optimise_named_routes to ActionController::Base.optimise_named_routes. Now you can set it in the config. ActionController::Routing::DynamicSegment#interpolation_chunk should call #to_s on all values before calling URI.escape. [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7724 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 6 ++++++ actionpack/lib/action_controller/base.rb | 7 ++++++- .../lib/action_controller/integration.rb | 2 +- actionpack/lib/action_controller/routing.rb | 19 +++++++------------ actionpack/test/controller/resources_test.rb | 4 ++-- actionpack/test/controller/routing_test.rb | 7 ++++++- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 134ad1f898..3bc5797800 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,11 @@ *SVN* +* Move ActionController::Routing.optimise_named_routes to ActionController::Base.optimise_named_routes. Now you can set it in the config. [Rick] + + config.action_controller.optimise_named_routes = false + +* ActionController::Routing::DynamicSegment#interpolation_chunk should call #to_s on all values before calling URI.escape. [Rick] + * Only accept session ids from cookies, prevents session fixation attacks. [bradediger] *2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.12.2 - 1.13.3] diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 74d0a6c09a..91ca05347d 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -329,7 +329,12 @@ module ActionController #:nodoc: # Sets the token parameter name for RequestForgery. Calling #protect_from_forgery sets it to :authenticity_token by default cattr_accessor :request_forgery_protection_token - + + # Indicates whether or not optimise the generated named + # route helper methods + cattr_accessor :optimise_named_routes + self.optimise_named_routes = true + # Controls whether request forgergy protection is turned on or not. Turned off by default only in test mode. class_inheritable_accessor :allow_forgery_protection self.allow_forgery_protection = true diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index c981c56e01..bde4bb5776 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -76,7 +76,7 @@ module ActionController # install the named routes in this session instance. # But we have to disable the optimisation code so that we can # generate routes without @request being initialized - Routing.optimise_named_routes=false + Base.optimise_named_routes=false Routing::Routes.reload! klass = class<