diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 2831c377bb23e184e5d735c834296c17d341cec7..f3139eceba2ba759b06979040b8ae54915f8532f 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed HasManyAssociation#find bugs when :finder_sql is set #4600 [lagroue@free.fr] + * Allow AR::Base#respond_to? to behave when @attributes is nil [zenspider] * Support eager includes when going through a polymorphic has_many association. [Rick] diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 8d82de0d0170e316098b279cabe1a35cf98740e7..52cad79484254422006c124aa94bd807b03b1041 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -59,7 +59,7 @@ def find(*args) if ids.size == 1 id = ids.first record = load_target.detect { |record| id == record.id } - expects_array? ? [record] : record + expects_array ? [ record ] : record else load_target.select { |record| ids.include?(record.id) } end