Monday, April 24, 2017

jQuery Turbolinks Stripe Subscription Problem

https://github.com/kossnocorp/jquery.turbolinks is a possible fix, the problem is that it is not compatible with newer versions of Turbolinks.

The workaround is to either not use different application layout files (one with stripe.js and one without stripe.js), so you have only one layout that has stripe.js or you can have two layouts but still include stripe.js on both. Eventhough only your payment pages need the stripe.js and results in a little duplication and might affect the performance in a very negligible amount, this will prevent the Turbolinks problem.

If you had used Rails cache to cache the pages, you must invalidate the cache by running in production:


 Rails.cache.clear

This will force the page to pickup the changes made to the layout files, otherwise you will see the latest file in the production but the browser will not see the updated file.