Hi everyone! I have installed Devise under the following settings:
* Rails 3.0.0.
* Ruby version: 1.9.2p0 (2010-08-18 revison 29036).
* Ubuntu 10.04.
* Devise version: 1.1.2
It appears the alert messages are not being displayed. The notices are
being displayed, no problem with those.
Has anyone noticed this in the meantime perhaps?
I might be having a similar issue, if I try to sign in (using Devise),
I do not get a message of anything happening if the login is
incorrect. (I assume some kind of error message should show up?)
If I'm on the login screen however and I do something wrong I do get
proper error notices showing up.
@Rick: What do you mean by "if I try to sign in (using Devise)" and
"If I'm on the login screen however"?
Are trying to sign in a Model from another controller and you redirect
back if login was not successful?
Everything works fine for me.
One more thing, make sure you set the flash messages explicitly if you
are overriding default Devise controllers' actions.
@Rick: What do you mean by "if I try to sign in (using Devise)" and
"If I'm on the login screen however"?
Sorry I screwed up the terminology a bit. I'm using :confirmable and
there is a screen where you can "sign up" which sends out a
registration email. This screen produces errors as expected. For
example if I use an existing email, I'll get proper errors:
However the by "sign in" screen I mean the main login screen. Here is
a screen shot of it - note here I entered an invalid login and I'm
getting no message:
Are trying to sign in a Model from another controller and you redirect
back if login was not successful?
I don't think I'm doing anything out of the ordinary (but I'm a newb
so possibly I am?) I'm using the standard views created by Devise (I
generated them and did add one field "name")
One more thing, make sure you set the flash messages explicitly if you
are overriding default Devise controllers' actions.
I haven't overridden any of Devices controllers.
Thanks for trying to help. I'm sure it'll be something stupid.
@Rick: Erros on "sign up" page are form errors, generated by
"devise_error_messages!" helper.
However, the errors of the "login" action are set via "flash[:alert]".
So you probably are missing
flash[:alert] print out line in your layout file.
Refer to the documentations (README) the last paragraph in
"Configuring controllers" section.
Regarding Rick's situation, I am not using customizations yet, it's
Devise's still default use.
Bad login message shows up. Errors on signup show up too.
and tundrax's point to look at configuring controllers helped where it says:
"Remember that Devise uses flash messages to let users know if sign in
was successful or failed. Devise expects your application to call
"flash[:notice]" and "flash[:alert]" as appropriate. "
(Sorry I hadn't looked there since didn't think it was related to that section.)
In my application layout I had:
<%= flash[:notice] %>
but I did not have
<%= flash[:alert] %>
adding radhames' loop, or the flash alert, solves it.
I take it the loop is better approach since it will work for any type
of flash message - notice or alert?
flash[:alert] is there. It does show the errors on a bad login, but it
doesn't show actions when:
* Trying to login when already logged in;
* Trying to logout when not logged in at all.