I’d like to integrate the sorcery-gem to achieve authentication while checking out in an online shop. I followed Ryan Bate’s Railscast episode 283 – authentication with Sorcery.
Given a vistor has put together some products in his session[:cart] and now wants to checkout. He clicks on “checkout” and the RailsApp checks if he is already logged in. If not, he will be redirected to sessions#new and got to log in.
The problem is that sorcery’s #login does a session_reset and so also session[:cart] will be destroyed.
Is there a nifty solution for that? I just can think of some, imho, dirty hacks like creating new controller actions or trying to save the cart temporarily in the database.
Cheers, CS
just do something like this in your session controller (the place you call login):
This way you’ll hand your cart around the session reset.
Bests,
JJS