Hi,
I'm trying to send information between AJAX calls using flash but the hash only seems to be updated the first time I run it.
This is the method being called remotely using a remote_form_tag: def authenticate @user = User.find_by_email(params[:email]) if @user.nil? flash.now[:email] = "UserLoginErrEmailNotFound" render( :partial => "login_form" ) elsif @user.password != params[:password] flash.now[:password] = "UserLoginErrInvalidPassword" render( :partial => "login_form" ) else session[:id] = @user.id session[:locale] = @user.locale redirect_to :controller => "welcome", :action => "index" end end
The first time I call it I enter a invalid email and get the following debug: --- !map:ActionController::Flash::FlashHash UserLoginErrEmailNotFound
If I enter a valid email, that is found in the database I should receive invalid password in the flash but I get this when debuging in the view: --- !map:ActionController::Flash::FlashHash UserLoginErrEmailNotFound
Why hasn't the flash changed in the view? I've added logger statements to the controller to make sure the flash contain the correct values. Any clues!?
Kind regards, Roland