As nearly everything in this world, quick prototyping benefit comes with a cost — and this cost is a nasty one, because it needs to be paid shortly after you enter production phase.
This blog post describes how to integerate JavasScript for the new Service Worker API into Ruby and Rails applications that uuse Sprockets for the Rails asset pipeline.