Identify and reduce/remove n+1 queries and use eager loading instead. The [bullet](https://github.com/flyerhzm/bullet) gem could help here.