Posted almost 4 years ago. Visible to the public.
Cookies and Rails Sessions
- What is a Cookie? Google it if you do not know.
- How are cookies transferred between your browser and the server?
- Open the development tools in your browser for this page. Can you find the cookies your browser stores for makandracards?
- In the network tab, can you see how the cookies are transferred to or from the server?
- Can you log yourself out by manipulating a cookie? Can you log yourself back in?
- Understand what domains mean to cookies
- Can cookies be shared between domains?
- Between subdomains?
- How does a tool like Google Analytics work?
- How do cookies expire? What are "session" cookies?
- What does a cookie's "secure" flag do? It it still relevant with HSTS?
- Look at Rails' API for managing cookies
- How do you set and delete cookies?
- What are signed cookies and how do they work?
- What are encrypted cookies and how do they work?
- Learn about Rails sessions
Exercise: Star movies
- In your MovieDB, implement a feature to star / unstar your favorite movies.
- Implement this with cookies or sessions without writing anything to the database.
- Try two separate ways of implementing this:
- Make an AJAX call and have the server set the cookies
- Set cookies directly on the client
- Is this a good way to implement the star feature?