This library helps to find where in your rails app sql query was run.
Dmitry Shaposhnik, Dmytro Shteflyuk
gem "query_tracer", "~> 0.1.0"