Rails app crashes on Heroku when a constant is initialized more than once

When you receive this kind of error on heroku, the best way to debbug it is to open the rails console:  heroku run console.

  heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"

But if your rails console run fine, it can be painful to figure out where is the problem. In my case, a constant was initialized more than once by mistake. It only throws this warning warning: already initialized constant MY_CONSTANT but crash my dyno on Heroku.