Flash messages not appearing

100 views
Skip to first unread message

DBA

unread,
Jun 3, 2010, 4:06:18 PM6/3/10
to Devise
Hello everyone,

I'm trying to setup my singup and signin interfaces with Devise.
Everything was going fine, until I figured that when the user submits
an erroneous form no flash message is appearing.

For this application I'm using Ruby 1.9.2-head, Rails 3 beta 3 and
Haml. In order to attempt to debug this issue I've placed the
following haml:

= flash.to_yaml
= flash[:notice]
= flash[:alert]
= flash[:error]

When the page first loads, before any user interaction, the yaml shows
the following: --- !map:ActionDispatch::Flash::FlashHash {}

After a user submits a form without filling any of the fields the same
yaml appears (--- !map:ActionDispatch::Flash::FlashHash {}) and no
flash messes are shown stating than an error has occurred.

Could someone help me understand this issue a bit better?

Best regards,
DBA

Carlos A. da Silva

unread,
Jun 4, 2010, 12:29:17 AM6/4/10
to Devise
Did you try this debug while signing in or up?

Flash messages are used by Devise only when signing in.
All other forms use default error messages.

--
Carlos Antonio

DBA

unread,
Jun 4, 2010, 7:54:31 AM6/4/10
to Devise
Hello Carlos,

Thanks for your prompt reply. I've only tried the signUP form, not the
signIN, which would explain why they weren't working on that screen.

What would be the recommended way to get the signup to also set the
flash messages?

Best regards,
DBA

Carlos A. da Silva

unread,
Jun 4, 2010, 8:28:59 AM6/4/10
to Devise
Using Rails 3 you're able to inherit from any Devise Controller. You
could create your own RegistrationsController inheriting from Devise
one, and handle the flash_message in the create method by yourself.

Please do some search in RegistrationsController here in the group and
also take a look at this thread:
http://groups.google.com/group/plataformatec-devise/browse_thread/thread/fb67cbe6e4347d8c/a9664cd0b8d44cc1?lnk=gst&q=RegistrationsController#a9664cd0b8d44cc1

--
Carlos Antonio

DBA

unread,
Jun 4, 2010, 3:34:41 PM6/4/10
to Devise
Obrigado Carlos.

Worked great :)

Best regards,
DBA

Carlos A. da Silva

unread,
Jun 4, 2010, 10:57:25 PM6/4/10
to Devise
Nice, you're welcome =).
And please, if you have any addition to the wiki, go ahead and update
it. Others might be having the same doubts.

--
Carlos Antonio
Reply all
Reply to author
Forward
0 new messages