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
:email: 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
:email: 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---