I am a Rails newbie and have a two-fold question. I recently started
working with authentication. The basic authentication system is
working for me, but I would like to catch errors and exceptions and
display appropriate messages to the user.
The first problem is that when I try to display an error message using
flash[:error]="error message", it doesn't get displayed.
flash[:notice] works all right. Here is the code snippet from the
controller for users where I observe the difference in behaviors.
@user = User.new(params[:user])
self.current_user = @user
flash[:notice] = "Thanks for signing up!"
flash[:error] = "There was a problem creating your account."
The user signup page uses the "create" action of the user controller.
When signup is successful, I get redirected appropriately and the
notice is displayed. However, when signup is unsuccessful, the browser
just displays an error page entitled " NameError in
Why does this happen?
Second, on the error page I see the session dump as follows:
:error: Passwords do not match. Please try again!
So, it seems that the actual error that occurs gets stored in
FlashHash in some way. Can I manually retrieve it and flash it on the
Thanks a lot for your help,