diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/application.rb | 5 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index 6e515756fe..b7f64af339 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -57,5 +57,10 @@ module <%= app_const_base %> # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] + +<% unless options[:skip_active_record] -%> + # Enable IdentityMap for Active Record, to disable set to false or remove the line below. + config.active_record.identity_map = true +<% end -%> end end diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 3b03e4eb3d..3a582f850f 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -215,6 +215,17 @@ module TestHelpers end end + def remove_from_config(str) + application_file = "#{app_path}/config/application.rb" + environment = File.read(application_file) + lines = File.readlines(application_file) + if environment =~ /(\n\s*end\s*end\s*)\Z/ + File.open(application_file, 'w') do |f| + lines.each {|line| f.puts(line) unless line =~ /#{str}/ } + end + end + end + def app_file(path, contents) FileUtils.mkdir_p File.dirname("#{app_path}/#{path}") File.open("#{app_path}/#{path}", 'w') do |f| @@ -231,6 +242,7 @@ module TestHelpers :activemodel, :activerecord, :activeresource] - arr + remove_from_config "config.active_record" if to_remove.include? :activerecord $:.reject! {|path| path =~ %r'/(#{to_remove.join('|')})/' } end |