0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

railsを勉強している時に永続的なセッションを作成するのに
便利なメソッドがあったので記録として残します。

実際のコード

.rb
cookies[:remember_token] = { value:   remember_token,
                             expires: 20.years.from_now.utc }

上記は20年後期限切れになる記憶トークンです。
これをメゾットを使うことで

.rb
cookies.permanent[:remember_token] = remember_token

のように書くことができます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?