Skip to content

Commit

Permalink
Preloader API changed in 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-vinsol committed Oct 25, 2017
1 parent d1199fc commit ec2572b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/graphql/preload/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def perform(records)
end

private def preload_association(records)
if ActiveRecord::VERSION::MAJOR > 3
if ((ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR >= 1) ||
ActiveRecord::VERSION::MAJOR > 4)
ActiveRecord::Associations::Preloader.new.preload(records, association)
else
ActiveRecord::Associations::Preloader.new(records, association).run
Expand Down

0 comments on commit ec2572b

Please sign in to comment.