'Issue with session in Rails

I am writing a rails app that involves a cart system stored in session. I did some googling and it turned out I can store the ID of my cart in the session hash like this session[:cart_id]. However, I noticed that if I open a new tab in my rails app, it still uses the same session. This means that multiple tabs of the app share the same cart. I don't want this to happen. Ideally, each browser should get its own cart. Is there any way I can resolve this?

Thanks!



Solution 1:[1]

If you're on the same browser, you'll always have the same session.

In Rails, the concept of session is implemented through cookies. And cookies are stored client-side on the browser, specific to each website.

(I could be entirely wrong, but I'd like to think the answer is no.)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TedTran2019