How to Get Current Host Url in Rails
how to get root url along with port number in rails

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 root_url or request.env[HTTP_HOST].
Use Case
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 ENV['HOST'].
Keep reading

Fix mise GitHub Rate Limit with a Token
mise makes unauthenticated GitHub API calls by default. When you hit the rate limit installing tools, a personal access token (no scopes required) fixes it permanently.

How to solve Deployment Failure-`assets:precompile`
I was trying to deploy rails 6 app on ec2 server using capistrano when precompile failure lead to whole deploymentt failure. I had to uninstall cmdtest and install yarn

How to Sort an Array of Objects in JavaScript
How to Sort an Array of Objects in JavaScript

What did you take away?
Thoughts, pushback, or a story of your own? Drop a reply below — I read every one.
Comments are powered by Disqus. By posting you agree to theirterms.