Skip to content

Commit

Permalink
Merge pull request #8 from ShubhamGupta/preload-bug-fix
Browse files Browse the repository at this point in the history
Preloader API changed in 4.1
  • Loading branch information
RoryO authored Oct 26, 2017
2 parents d1199fc + ec2572b commit abaf631
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 abaf631

Please sign in to comment.