This gem that will help you to solving the N+1 problem in Rails.