From 838cb1aa507746b3562931bb63cf4f474363e17a Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 23 Oct 2008 18:53:13 -0700 Subject: Skip collection ids reader optimization if using :finder_sql --- activerecord/lib/active_record/associations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 187caa13d0..52f6a04da1 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1296,7 +1296,7 @@ module ActiveRecord end define_method("#{reflection.name.to_s.singularize}_ids") do - if send(reflection.name).loaded? + if send(reflection.name).loaded? || reflection.options[:finder_sql] send(reflection.name).map(&:id) else send(reflection.name).all(:select => "#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").map(&:id) -- cgit v1.2.3