Finished reading chapter 9 and im a little bit confused.
In the tutorial, Modules are used instead of creating a Model and
working in a class inside a module , like in authenticating passwords.
Wouldn’t that be possible? Or is it unnecessary since we’re not
messing with a database in terms of storing data?
what is the difference between session[:remember_token] = user.id
and cookies[:remember_token] ?
Session stores the cookie locally until we exit the browser and then
it gets deleted whereas cookies is permanent stored even after we exit
In section 9.3.3 we are being introduced to the curent user with
the code in the module SessionsHelper
self.current_user = user
Why do we use the “self”? and not just current_user since we use it as
a variable object and not as an object attribute ? Or is it a way to
say sessions.current_user = user ?
- What’s the purpose of def current_user=(user) and of def
current_user in listing 9.16 ? Couldnt we avoid all that using a
Thank you in advance!