From bf658a906bf32127429f3ba808cef65c49b59607 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Fri, 26 Oct 2007 03:42:28 +0000 Subject: Allow find on a has_many association defined with :finder_sql to accept id arguments as strings like regular find does. Closes #9916 [krishna] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8030 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations/has_many_association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index b1b9895832..2880bde3a4 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -37,7 +37,7 @@ module ActiveRecord # If using a custom finder_sql, scan the entire collection. if @reflection.options[:finder_sql] expects_array = args.first.kind_of?(Array) - ids = args.flatten.compact.uniq + ids = args.flatten.compact.uniq.map(&:to_i) if ids.size == 1 id = ids.first -- cgit v1.2.3