开发者

Devise Flash Message Not Begin Set on First Post

I have a Rails 3.0.9 application running Devise 1.4.2 that overrides the default devise views and displays the flash messages (if present). The problem is, the flash parameter is not being set ever on the first POST. For example: if you login without an e开发者_JAVA百科mail or password the flash will be blank. However if you login a second time (still with email and password blank) the flash is set to: "Invalid email or password". Any idea why?


I had the same problem. In my case it was authenticate_or_request_with_http_digest in ApplicationController, because it results in an additional redirect. Here's how it works:

  1. BROWSER -> APP: Post something
  2. APP -> BROWSER: Ok, but I have to redirect you to page "FOO" (setting flash)
  3. BROWSER -> APP: Give me page "FOO" without credentials
  4. APP -> BROWSER: Get Lost (now flash should have been displayed)
  5. BROWSER -> APP: Ok, give me page with credentials
  6. APP -> BROWSER: Ok (but at this time flash is already empty)

Result: No flash displayed...

Hope it helped you! Kostia


Turned out to be a conflict with another gem (Active Scaffold). Removing that gem fixes the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜