diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-24 11:37:17 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-09-24 11:37:17 -0700 |
commit | 4a785415559cdb8aae00d636bd364994fec36311 (patch) | |
tree | 4095462d289a6569ffa280ffb5f610f8da81502f /activerecord/lib | |
parent | 2075f39d726cef361170218fd16421fc52bed5a8 (diff) | |
download | rails-4a785415559cdb8aae00d636bd364994fec36311.tar.gz rails-4a785415559cdb8aae00d636bd364994fec36311.tar.bz2 rails-4a785415559cdb8aae00d636bd364994fec36311.zip |
all records have a preloaded, so eliminate that conditional
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/preloader/through_association.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index 15fdba51f3..7187cf38fd 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -52,17 +52,13 @@ module ActiveRecord r.send(source_reflection.name) }.compact - if pl - loaded_records = pl.preloaded_records - i = 0 - record_index = loaded_records.each_with_object({}) { |r,indexes| - indexes[r] = i - i += 1 - } - rhs_records.sort_by { |rhs| record_index[rhs] } - else - rhs_records - end + loaded_records = pl.preloaded_records + i = 0 + record_index = loaded_records.each_with_object({}) { |r,indexes| + indexes[r] = i + i += 1 + } + rhs_records.sort_by { |rhs| record_index[rhs] } end } end |