From 57e9495e64f6ff6e59bc7e25ee05df43aac472e1 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 16 Jul 2017 21:06:51 +0900 Subject: Fix `create_with` with multiparameter attributes --- activerecord/lib/active_record/scoping.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/scoping.rb b/activerecord/lib/active_record/scoping.rb index 94e0ef6724..82e20a32d0 100644 --- a/activerecord/lib/active_record/scoping.rb +++ b/activerecord/lib/active_record/scoping.rb @@ -33,9 +33,8 @@ module ActiveRecord def populate_with_current_scope_attributes # :nodoc: return unless self.class.scope_attributes? - self.class.scope_attributes.each do |att, value| - send("#{att}=", value) if respond_to?("#{att}=") - end + attributes = self.class.scope_attributes + _assign_attributes(attributes) if attributes.any? end def initialize_internals_callback # :nodoc: -- cgit v1.2.3