From 0f4d005501c4230fcdf8d64d530639f5bcda6086 Mon Sep 17 00:00:00 2001 From: Nicholas Mulder Date: Fri, 29 Jun 2012 10:47:44 -0400 Subject: Persist glob when replacing a path When Rails::Paths::Root's []= is used to replace a path it should persist the previous path's glob. Without passing the glob along we get gnarly bugs when trying to wire up things like engines. module FooEngine class Engine < ::Rails::Engine isolate_namespace FooEngine config.paths['config/initializers'] = "lib/foo_engine/initializers" end end ## Example of behaviour before this commit. # # Before the initializer override: >> FooEngine::Engine.config.paths["config/initializers"].glob => "**/*.rb" # After the initializer override: >> FooEngine::Engine.config.paths["config/initializers"].glob => nil ## Example of behaviour after this commit. # # Before the initializer override: >> FooEngine::Engine.config.paths["config/initializers"].glob => "**/*.rb" # After the initializer override: >> FooEngine::Engine.config.paths["config/initializers"].glob => "**/*.rb" --- railties/lib/rails/paths.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails/paths.rb') diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb index 6cd9c7bc95..316ecca87b 100644 --- a/railties/lib/rails/paths.rb +++ b/railties/lib/rails/paths.rb @@ -51,7 +51,8 @@ module Rails end def []=(path, value) - add(path, :with => value) + glob = self[path] ? self[path].glob : nil + add(path, :with => value, :glob => glob) end def add(path, options={}) -- cgit v1.2.3