diff options
author | Frederick Cheung <frederick.cheung@gmail.com> | 2008-12-17 23:39:09 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-12-18 19:19:35 +0000 |
commit | 707d0dd3e1e8df7771073670e4257d933d2818f9 (patch) | |
tree | 97ac33fde3f7e4004d607911ad1b9a5437ddf037 /activerecord/lib/active_record | |
parent | 428e77bf0fcee4369cb8d94011141f791b8e2ba9 (diff) | |
download | rails-707d0dd3e1e8df7771073670e4257d933d2818f9.tar.gz rails-707d0dd3e1e8df7771073670e4257d933d2818f9.tar.bz2 rails-707d0dd3e1e8df7771073670e4257d933d2818f9.zip |
Fix preloading of belongs_to with null foreign key generating useless query [#1027 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/association_preload.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/association_preload.rb b/activerecord/lib/active_record/association_preload.rb index 99c3ce5e62..d8aa1051bd 100644 --- a/activerecord/lib/active_record/association_preload.rb +++ b/activerecord/lib/active_record/association_preload.rb @@ -307,6 +307,7 @@ module ActiveRecord klasses_and_ids.each do |klass_and_id| klass_name, id_map = *klass_and_id + next if id_map.empty? klass = klass_name.constantize table_name = klass.quoted_table_name |