Skip to content

Commit

Permalink
Bring back passing single record support for Preloader
Browse files Browse the repository at this point in the history
I removed redundant `Array.wrap(records)` since `Preloader` is nodoc
class and Active Record always pass `records` as an array to
`Preloader`.
But if users relies on that behavior, it is not worth dropping its
behavior.

Fixes #31661.
  • Loading branch information
kamipo committed Jan 9, 2018
1 parent d749b5d commit b8e5d4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/associations/preloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Preloader #:nodoc:
# { author: :avatar }
# [ :books, { author: :avatar } ]
def preload(records, associations, preload_scope = nil)
records = records.compact
records = Array.wrap(records).compact

if records.empty?
[]
Expand Down

0 comments on commit b8e5d4f

Please sign in to comment.