diff options
author | Joshua Bates <joshuabates@gmail.com> | 2008-04-17 11:58:32 -0700 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-04-23 20:18:09 +1200 |
commit | b6aa0e13b4e590b82550a6464924f431e57229df (patch) | |
tree | 48afd640a589e8d727ec52eda8daadc29a183356 /activerecord/lib/active_record | |
parent | ae51013c3f7b8a8579fcb99d889ed80e9dd75797 (diff) | |
download | rails-b6aa0e13b4e590b82550a6464924f431e57229df.tar.gz rails-b6aa0e13b4e590b82550a6464924f431e57229df.tar.bz2 rails-b6aa0e13b4e590b82550a6464924f431e57229df.zip |
Fix include? on has_many collections with finder_sql to fall back to Array include? rather than try to use SQL.
[#18 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 9c724d2117..7e47bf7bdf 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -214,6 +214,7 @@ module ActiveRecord def include?(record) return false unless record.is_a?(@reflection.klass) + load_target if @reflection.options[:finder_sql] && !loaded? return @target.include?(record) if loaded? exists?(record) end |