From eedbf87d15b99a7cae38b0d8894fc39f1e70a81e Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 8 Jul 2010 15:42:40 +0200 Subject: New way of generating urls for Application from Engine. It's based specifying application's script_name with: Rails.application.default_url_options = {:script_name => "/foo"} default_url_options method is delegated to routes. If router used to generate url differs from the router passed via env it always overwrites :script_name with this value. --- railties/lib/rails/application.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 3dba5f78a2..fb04351b35 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -50,6 +50,8 @@ module Rails end end + delegate :default_url_options, :default_url_options=, :to => :routes + # This method is called just after an application inherits from Rails::Application, # allowing the developer to load classes in lib and use them during application # configuration. @@ -121,11 +123,6 @@ module Rails alias :build_middleware_stack :app def call(env) - if Rails.application == self - env["ORIGINAL_SCRIPT_NAME"] = env["SCRIPT_NAME"] - env["action_dispatch.parent_routes"] = routes - end - env["action_dispatch.routes"] = routes app.call(env.reverse_merge!(env_defaults)) end -- cgit v1.2.3