author avatar

mrinmoy

Tue Mar 13 2018

preloading data for custom sql, profiles = Profile.find_by_sql(sql_query) ActiveRecord::Associations::Preloader.new.preload(profiles, :user)

Some more stuff here http://cha1tanya.com/2013/10/26/preload-associations-with-find-by-sql.html