Problem with session

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs