diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-10-28 20:25:20 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-11-02 17:14:52 +0100 |
commit | a5311ee86bffad3f0bce00babd1ff5d78ec85618 (patch) | |
tree | ec8c04d706fa778454bfe9d8e7e0d7b70ddc77a7 /railties/lib/rails | |
parent | 5071b727b438f1ca6be502c906f5af751abb0229 (diff) | |
download | rails-a5311ee86bffad3f0bce00babd1ff5d78ec85618.tar.gz rails-a5311ee86bffad3f0bce00babd1ff5d78ec85618.tar.bz2 rails-a5311ee86bffad3f0bce00babd1ff5d78ec85618.zip |
Make deep copy of application generators on engine initialization.
Otherwise nested hashes will be same objects for both application and engine,
which will result in overwriting each others values on changes.
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/configuration.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails/engine/configuration.rb | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 8369795e71..66fab0a760 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -1,5 +1,6 @@ require 'active_support/deprecation' require 'active_support/ordered_options' +require 'active_support/core_ext/hash/deep_dup' require 'rails/paths' require 'rails/rack' @@ -51,6 +52,13 @@ module Rails @colorize_logging = true end + def initialize_copy(source) + @aliases = @aliases.deep_dup + @options = @options.deep_dup + @fallbacks = @fallbacks.deep_dup + @templates = @templates.dup + end + def method_missing(method, *args) method = method.to_s.sub(/=$/, '').to_sym diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb index 5607628d96..4f458b0aee 100644 --- a/railties/lib/rails/engine/configuration.rb +++ b/railties/lib/rails/engine/configuration.rb @@ -10,7 +10,7 @@ module Rails def initialize(root=nil) super() @root = root - @generators = app_generators + @generators = app_generators.dup end # Returns the middleware stack for the engine. |