Hi,
I have problem when i tried to logging logging successfull,
but when tried to find out the current cuser details by session it
always says nil
code for loging:-
@user = User.new(params[:user])
#session[:user_id] = nil
case request.method
when :post
respond_to do |format|
if @current_user = User.authenticate(@user.email, params[:user]
[:hashed_password])
session[:user_id] = @current_user.id
flash[:notice] = "user login successfully !!!"
format.html { redirect_to(users_path) }
else
flash[:notice] = " better try next time !!!"
format.html { render :action => "index" }
end
i want to fetch user details from user table by from user controller
Couldn''t find User with ID=2
but the current user id is not 2, it always take id 2
code:-
@user=User.find(session[:user_id])
Thank''s
ajit
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---