The Web was built to do one thing at a time. Each request is, from the
point of view of the client and server, completely independent of every
other. A group of requests might all operate on the same database, and there
can be clear paths from one part of an application to another, but for the
most part, HTTP and scalable web application design both try to keep
requests as independent as possible. It makes the underlying infrastructure
Rails balances that simplicity of infrastructure with application
developers’ need for a coherent way to maintain context. Rails supports
several mechanisms for keeping track of information about users. If you want
to keep track of users manually, you can work with cookies. If you want to
keep track of users for a brief series of interactions, Rails’ built-in
session support should meet your needs.
If you want to keep track of users on a long-term basis, you’ll want
to use the authentication tools covered in Chapter 14.
Getting Into and Out of Cookies
Get Learning Rails 3 now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.