From 9d109302f139a23d18de605454074777b995e4c4 Mon Sep 17 00:00:00 2001 From: Jon Buda Date: Tue, 27 Jul 2010 20:04:36 -0500 Subject: fixed joining of attributes when using find_or_create_by with multiple attributes through an association Signed-off-by: Santiago Pastorino --- activerecord/lib/active_record/associations/association_collection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 4ce3b34819..b5159eead3 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -422,7 +422,7 @@ module ActiveRecord match = DynamicFinderMatch.match(method) if match && match.creator? attributes = match.attribute_names - return send(:"find_by_#{attributes.join('and')}", *args) || create(Hash[attributes.zip(args)]) + return send(:"find_by_#{attributes.join('_and_')}", *args) || create(Hash[attributes.zip(args)]) end if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method)) -- cgit v1.2.3