1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
Piotr Sarnacki 2010-10-28 20:25:20 +02:00
parent 5071b727b4
commit a5311ee86b
3 changed files with 12 additions and 1 deletions

View file

@ -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

View file

@ -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.

View file

@ -701,6 +701,9 @@ module RailtiesTest
generators = Bukkits::Engine.config.generators.options[:rails]
assert_equal :active_record, generators[:orm]
assert_equal :rspec , generators[:test_framework]
app_generators = Rails.application.config.generators.options[:rails]
assert_equal :test_unit , app_generators[:test_framework]
end
end
end