虽然偶尔也没有任何意义,但它会起作用(但只有一次)。
如果我点击退出,我明白了:
Started GET "/users/sign_out" for 127.0.0.1 at 2014-04-06 11:30:13 +0200
Processing by Devise::SessionsController#destroy as HTML
Redirected to http://love.website.dev/
然后,如果我可以登录到登录端,日志会返回:
Started POST "/users/sign_in" for 127.0.0.1 at 2014-04-06 12:15:00 +0200
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"o8Gb8iJc0hsecretm3EXkwgLnkcSPc6c/iAi8Q=", "user"=>{"email"=>"trip@trip.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
Redirected to http://love.mywebsite.dev/
Completed 302 Found in 306ms (ActiveRecord: 0.0ms)
请注意,这适用于IE,Firefox和Safari ..只是Chrome有这个问题。
我在Devise中跟踪了一条路径,并在sign_in_out.rb:72
:
users = Devise.mappings.keys.map { |s| warden.user(scope: s, run_callbacks: false) }
返回:
> [nil]
嗯..所以事实证明Warden没有创建会话变量..
> session
-> {}
但我使用Firefox:
=> {"warden.user.user.key"=>[[1], "$2a$10$eGalHPmX4ab32HR0VHwHP."],
"flash"=>
#<ActionDispatch::Flash::FlashHash:0x007fb8cbad3fc8
@closed=false,
@flashes={:notice=>"Signed in successfully."},
@now=nil,
@used=#<Set: {:notice}>>}
有什么想法吗?
答案 0 :(得分:0)
真是奇怪的答案。对不起,这太奇怪了。但我发现,如果我只是改变了我传递的密钥(是的,我使用同一个应用程序成功使用了四年),那么它就可以了。
MyApplication.config.session_store :active_record_store,
:key => '_new_superfluously_named_session',