From the course: Adding Stripe Payments to Your Ruby on Rails Application

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Making it turbolinks compatible

Making it turbolinks compatible

- [Instructor] The last thing that we need to do here before we go to the server side is we need to fix our JavaScript so that it is fully Turbolinks compatible. Turbolinks is built into Rails 5, it comes with it, it's on by default and we'll be using it in this example except we don't have our JavaScript that's compatible with it just yet. So if you were to click the subscribe button from a product page, the JavaScript is already executed on here, but Turbolinks is going to intercept this click and load the new page with an Ajax request. And from here, our JavaScript from Stripe is actually not going to execute and we can see that by clicking the button and going to our Rails logs and you'll see here that the only thing that we really received was the plan, UTFA, and the authenticity token. And we didn't receive any of the Stripe field details. So we know our JavaScript is not actually executing and not sending over those parameters. And the reason for that is because we need to tell…

Contents