Skip to content

Commit

Permalink
update syntax for preloader object initialization in Thread#nested_co…
Browse files Browse the repository at this point in the history
…mments_for
  • Loading branch information
PhilipDeFraties committed Dec 26, 2024
1 parent 29739fe commit 99edfb5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/models/commontator/thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ def nested_comments_for(user, comments, show_all)
).tap do |nested_comments|
next unless is_votable?

ActiveRecord::Associations::Preloader.new.preload(
nested_comments.flatten, :votes_for, ActsAsVotable::Vote.where(voter: user)
ActiveRecord::Associations::Preloader.new(
records: nested_comments.flatten,
associations: :votes_for,
scope: ActsAsVotable::Vote.where(voter: user)
)
end
end
Expand Down

0 comments on commit 99edfb5

Please sign in to comment.