This is what I have found out from another SO Answer Disable Rails SQL logging in console
ActiveRecord::Base.logger.silence do
User.where(auth_token: request.headers['X-AUTH']).first
end
But the method seems to be deprecated. Is there any latest way to silence the logs for queries in a block?