From cd9592959f9f16b228ac3f4bc6fc92932253f8dc Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Thu, 9 May 2013 13:08:44 -0400 Subject: scope_chain should not be mutated for other reflections Currently `scope_chain` uses same array for building different `scope_chain` for different associations. During processing these arrays are sometimes mutated and because of in-place mutation the changed `scope_chain` impacts other reflections. Fix is to dup the value before adding to the `scope_chain`. Fixes #3882. --- activerecord/test/models/hotel.rb | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 activerecord/test/models/hotel.rb (limited to 'activerecord/test/models/hotel.rb') diff --git a/activerecord/test/models/hotel.rb b/activerecord/test/models/hotel.rb new file mode 100644 index 0000000000..b352cd22f3 --- /dev/null +++ b/activerecord/test/models/hotel.rb @@ -0,0 +1,6 @@ +class Hotel < ActiveRecord::Base + has_many :departments + has_many :chefs, through: :departments + has_many :cake_designers, source_type: 'CakeDesigner', source: :employable, through: :chefs + has_many :drink_designers, source_type: 'DrinkDesigner', source: :employable, through: :chefs +end -- cgit v1.2.3