Chapter 7. Advanced login
Although the basic login functions in Chapter 6 are probably already good enough for government work, there’s one feature we’d like to add that turns out to be both challenging and instructive: a “remember me” box that, when checked, allows RailsSpace to remember the login status of its users. Like basic login, this involves using the session to maintain user state, but it also requires using browser cookies (and the methods Rails has for manipulating them). Cookies represent a more permanent way of maintaining state than the session, allowing us to remember users even after they’ve closed their browsers.
Implementing the “remember me” feature is surprisingly complicated, producing rather bloated and ugly code. Before ...
Get RailsSpace: Building a Social Networking Website with Ruby on Rails™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.