I’ve made a basic cart for my web app, I’m just having a hard time thinking of how to bridge the gap to making a payment. I got the cart from Ryan Bates’s RailsCast and am using his PayPal methods as well. I’m using Devise to handle authentication.
Before a user is allowed to hit ‘checkout’, they need to be logged in (so I know who bought what).
Ryan just has the checkout link go directly to paypal. I can only allow the checkout link to go to paypal if the user has logged on.
Do I need to make another model & controller (maybe invoice?) and do a before :authenticate_user! on a method in invoice and then have the checkout link actually link_to the invoice controller? Will taht actually direct a user to sign-in/up, then upon completion send the user to paypal?
I’m trying to make the flow so that a user only has to click “check out” once.
Thanks
I ended up putting a new action in my cart called
checkoutand setting callingThen Devise takes off.
Maybe obvious, but I definitely had to think about it.