From 1860d873f23446ec9c442a9a8625b74f0dd42594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 9 Dec 2010 21:18:41 +0100 Subject: Ensure asset_path defaults to nil for application --- railties/lib/rails/application.rb | 4 ++++ railties/lib/rails/engine.rb | 7 ++++++- railties/test/application/configuration_test.rb | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 182068071d..b248bc737c 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -138,6 +138,10 @@ module Rails protected + def default_asset_path + nil + end + def default_middleware_stack ActionDispatch::MiddlewareStack.new.tap do |middleware| rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index b188fdfca1..cda0e0a135 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -499,7 +499,7 @@ module Rails end initializer :append_asset_paths do - config.asset_path ||= "/#{railtie_name}%s" + config.asset_path ||= default_asset_path public_path = paths["public"].first if config.compiled_asset_path && File.exist?(public_path) @@ -553,6 +553,11 @@ module Rails end protected + + def default_asset_path + "/#{railtie_name}%s" + end + def routes? defined?(@routes) end diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index b8d0854286..c12c4a4660 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -95,6 +95,11 @@ module ApplicationTests assert AppTemplate::Application.config.allow_concurrency end + test "asset_path defaults to nil for application" do + require "#{app_path}/config/environment" + assert_equal nil, AppTemplate::Application.config.asset_path + end + test "the application can be marked as threadsafe when there are no frameworks" do FileUtils.rm_rf("#{app_path}/config/environments") add_to_config <<-RUBY -- cgit v1.2.3