aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJon Buda <jon.buda@gmail.com>2010-07-27 20:04:36 -0500
committerSantiago Pastorino <santiago@wyeworks.com>2010-07-28 00:42:48 -0300
commit9d109302f139a23d18de605454074777b995e4c4 (patch)
tree85b5f8ca7ad84610e5e11ee6c3c6e6cc7cc2d4e8 /activerecord/lib/active_record
parentaa24ea41d00e4a5a1de317a7356aca357d27c3ff (diff)
downloadrails-9d109302f139a23d18de605454074777b995e4c4.tar.gz
rails-9d109302f139a23d18de605454074777b995e4c4.tar.bz2
rails-9d109302f139a23d18de605454074777b995e4c4.zip
fixed joining of attributes when using find_or_create_by with multiple attributes through an association
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb2
1 files changed, 1 insertions, 1 deletions
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))