In Rails 6, Adding an icon to the HTML tab is very easy with 3 simple steps.
For the basic understanding on Webpacker, you may refer the useful guide by Chris Oliver (Webpacker Setup)
The images directory will hold all the images that we link in the project. We can add a types .png, .ico, or .jpeg, but I'd prefer .png as it supports better colors.
const images = require.context('.../images', true)
Now, with this reference, we can embed all the images in our HTML with a pack tag.
<%= image_pack_tag 'example.png' %>
Now finally, embed the newly downloaded home_icon in HTML view with a helper method favicon_pack_tag.
After compiling, the HTML would look like this.
<link rel="shortcut icon" type="image/x-icon" href="pack/media/images/brand-icon-a3423sf.png">
As we can see the icon is being pointed to the image in the pack directory.
That's all we need, CHEERS!!