Hello fellow brethren,
i can’t seem to get sessions to work. As it is more or less one function with no setup required i am kind of stumped what could cause this. Im attaching the code snippet from the book. It always is rescued and never recovers the session.
module CurrentCart extend ActiveSupport::Concern private def set_cart @cart = Cart.find(session[:card_id]) rescue ActiveRecord::RecordNotFound @cart = Cart.create session[:cart_id] = @cart.id end end
Any further guidance would be much appreciated, because it is driving me seriously insane :)
Kind Regards, Matthias Weidemann