在Rails 4中重新启动服务器后,Cookie会话存储的行为

时间:2017-04-07 17:24:37

标签: ruby-on-rails session cookies

我有一个带有cookie会话存储的rails 4应用程序。重新启动应用程序后,似乎重新创建了用户会话,并且浏览器收到了新的会话ID,但用户无需登录,因为新会话保存了最后一个信息;但是我想初始化会话,例如设置正确的语言环境 - 是否有任何我可以用于此目的的事件? 我已经验证了它不是从cookie中恢复current_user的设备所以我认为它是某种会话重启。

Gems included by the bundle:
  * actionmailer (4.1.15)
  * actionpack (4.1.15)
  * actionview (4.1.15)
  * activemodel (4.1.15)
  * activerecord (4.1.15)
  * activerecord-sqlserver-adapter (4.1.6)
  * activesupport (4.1.15)
  * ar-octopus (0.8.6)
  * arel (5.0.1.20140414130214)
  * autoprefixer-rails (6.3.6.2)
  * bcrypt (3.1.11)
  * bootstrap-sass (3.3.6)
  * bootstrap_form (2.6.0)
  * builder (3.2.3)
  * bundler (1.13.6)
  * byebug (9.0.6)
  * cocoon (1.2.9)
  * coffee-rails (4.1.1)
  * coffee-script (2.4.1)
  * coffee-script-source (1.10.0)
  * concurrent-ruby (1.0.2)
  * daemons (1.2.3)
  * devise (3.5.3)
  * devise_ldap_authenticatable (0.8.5)
  * erubis (2.7.0)
  * eventmachine (1.2.0.1)
  * exception_notification (4.1.4)
  * execjs (2.7.0)
  * faraday (0.9.2)
  * flipper (0.7.5)
  * flipper-ui (0.7.5)
  * hashie (3.4.4)
  * i18n (0.8.1)
  * json (1.8.6)
  * jwt (1.5.4)
  * mail (2.6.4)
  * mime-types (3.1)
  * mime-types-data (3.2016.0521)
  * mini_portile2 (2.1.0)
  * minitest (5.10.1)
  * multi_json (1.12.1)
  * multi_logger (0.1.0)
  * multi_xml (0.5.5)
  * multipart-post (2.0.0)
  * net-ldap (0.11)
  * oauth2 (1.0.0)
  * omniauth (1.3.1)
  * omniauth-google-oauth2 (0.4.1 1cd603b)
  * omniauth-oauth2 (1.4.0)
  * orm_adapter (0.5.0)
  * protected_attributes (1.1.3)
  * rack (1.5.5)
  * rack-protection (1.5.3)
  * rack-test (0.6.3)
  * rails (4.1.15)
  * railties (4.1.15)
  * rake (11.2.2)
  * responders (1.1.2)
  * sass (3.4.22)
  * sass-rails (5.0.4)
  * sprockets (3.6.1)
  * sprockets-rails (2.3.3)
  * thin (1.7.0)
  * thor (0.19.1)
  * thread_safe (0.3.6)
  * tilt (2.0.5)
  * tiny_tds (1.0.5)
  * tzinfo (1.2.2)
  * tzinfo-data (1.2016.5)
  * uglifier (3.0.0)
  * warden (1.2.6)

1 个答案:

答案 0 :(得分:0)

现在我正在更改secret_key_base以在重启期间使所有会话无效但是知道如何在没有它的情况下处理这种情况会很棒