I noticed from the time of Progate that I was next to session
As you progress through the Rails tutorial
Something like a variable called a session Login maintenance mechanism using cookies to supplement it I had a feeling of being moody, but in reality
Both
--Mechanism for making HTML stateful --Both are stored in cookies by default
However
--session was implemented by Rails, but login maintenance by cookie was implemented later. --session has a time limit (default?), While the latter is permanent (intentionally designed)
I used a time-limited cookie A mechanism for making HTML stateful called a session ** The developer did not intend ** to implement the session method in Rail.
Stateless in an instant DIVE INTO CODE | Learn about login information retention
Is it a ** mechanism like Cookie **? I did it in Chapter 8 of the Rails tutorial
If you think In the first place, Rails stores session in cookie by default.
I checked it with Chrome's developer tools
I have a _sample_app_session
that seems to be for the Rails tutorial sample_app
Furthermore, the expiration date is ** "at the end of the browser session" **. This was the reason for the ephemeral feel imprinted in the Rails tutorial.
session
in Rails?session
is a method, not a variable
Since it was automatically generated by the process of rails new sample_app
I understood that ** it was used as a matter of course **
For example, if Rails new hoge is installed with Rails installed, a Rails application will be created, and if rails g controller sessions in the hoge directory will generate SessionsController that inherits ApplicationController, it will be written as session [: hoge] from the beginning. You can use session. Complete understanding of Rails session-Qiita
I used this as a reference to understand the reality of Rails sessions a little easier. [Rails] How to use Session --Qiita
Recommended Posts