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.
Adding a new subscription page
From the course: Adding Stripe Payments to Your Ruby on Rails Application
Adding a new subscription page
- Now before we can get into adding the stripe JavaScript, we actually need a page in our Rails application to add the credit card form in, so we need to build the URL for our users to visit that has our payment details, and the form that they can fill out. So let's do that by going into our routes file and saying resource, without the s, subscription, and this is going to create a singular resource for a subscription, and that will be for every user that has an account. They will be able to access their subscription. So they should only ever have one subscription to our service, and that's why we're not making this plural. Now, if we go to view a product, we can actually set up a link here in order to take us to that subscription route. So, let's go do that. Let's go to productsshow.html in our app/views/ folder, and here we'll say to add a link to subscribe, and this will take us to a new subscription path, which is one of the new routes we just added, and we'll put a class on this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.