https://medium.com/@jha.kkumar/advanced-active-record-techniques-elevating-your-rails-queries-dedf120fac46