Rails v2.3 : Difference between session and cookies
ruby-on-rails, ruby-on-rails-3, ruby-on-rails-3.1
Solution
Sessions & Cookies both hold the ability to store some information (e.g : the current_user id) in between two or more requests which (in http) are otherwise stateless.
But Session is more of an abstract concept related to the notion of being in a certain state for a specific amount of time : the info it contains can be stored in the database, in a server side file, in a redis hash OR in a cookie.
Cookies are always the little text file navigators have to store some persistent data in between requests... But having some data on the client side can be insecure so that's why it is often encrypted. But it's true the notion can overlap with session.
TL;DR : session the abstract concept of holding temporary data. Cookies one (common) way of doing it.
Problem
I am learning Rails by reading the online guide(for Rails v2.3). The guide is great, however, there is a confusion for me, that's: there is a chapter explains the Session of Rails and another chapter explains Cookies of Rails. The explanation is easy to understand separately, but when compare the two, reader like me does not see the significant difference between Session and Cookies . Especially under which situation session should be used and under which situation Cookies should be used ? Besides, in the session chapter, there is a concept of CookieStore , what is the difference between the CookieStore and Cookies then? Could someone explain to me these?