i'm trying implement e-commerce app. in it, allow user browse products , put them cart before signing in. prompt user sign in upon checkout.
however, i'm losing track of user because user's session id changes upon sign in. due this, im unable associate items user placed cart (stored in redis) user placed them in after user signs in application.
does have idea how circumvented?
thanks.
cheers!
found solution. needs done set session.options[:renew] = false , session id still same before & after signing in.
please refer implementation below
class sessionscontroller < devise::sessionscontroller respond_to :json def create super session.options[:renew] = false end def destroy logger.info "logging out: #{current_user.email}; session id: #{session.id}" $redis.del "cart_#{session.id}" super end end
Comments
Post a Comment