What is the way to use n+1 query problem?

please any idea for production env?

in development, I am using bullet gem.

Please any valid idea for this

Most APM services will include a feature to help you detect and eliminate N+1. Iā€™d recommend Scout.

You can also try: GitHub - MiniProfiler/rack-mini-profiler: Profiler for your development and production Ruby rack apps.