From 411e4597d552aa091cfe3dc76a83bdaffe02da1a Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 8 Mar 2016 11:46:11 +0900 Subject: Preserve readonly flag only for readonly association Fixes #24093 --- activerecord/lib/active_record/associations/preloader/association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations/preloader') diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 3032bc786e..f7b9aa7785 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -113,7 +113,7 @@ module ActiveRecord end def reflection_scope - @reflection_scope ||= reflection.scope ? klass.unscoped.instance_exec(nil, &reflection.scope) : klass.unscoped + @reflection_scope ||= reflection.scope_for(klass) end def build_scope -- cgit v1.2.3