E
E
eldar_web2016-04-20 15:03:06
Ruby on Rails
eldar_web, 2016-04-20 15:03:06

How to set session time in Ruby on Rails?

I store id users like this: session[:user_id] = id
And how to set the session time?
But I know how to set the time if using cookies, but is it possible to store the user id in cookies?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav German, 2016-04-21
@eldar_web

If you use session storage in cookies, then Rack::Session::Cookie is used to manage them in rails.
For configuration, edit config/initializers/session_store.rb

Application.config.session_store :cookie_store, key: '_name_session', expire_after: 24.hours

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question