You are in right place if you want to get root url along with port number in rails.
Code that works
This can be achieved by either
In applications you may need to generate url that will link back to your application while sending email.
Problems it has solved:
Previously, we used to have environment variable like
HOST: localhost:3000 saved in
application.yml which would be later called by