Hai!
I have two controller. the one is first_controller and another one is second_controller.
first_controller.rb
def login . . if @user && @user.password == params[:user][:password] session[:user_id] = @user.id redirect_to :controller => "second_controller", :action => "index" end end
second_controller.rb
def index if session[:user_id] != nil logger.info" The user id is not null" else logger.info" The user id is null" end end
#=======Result The user id is not null # 1st time The user id is null # 2nd time The user id is not null # 3rd time The user id is not null # 4th time The user id is null # 5th time The user id is not null # 6th time The user id is not null # 7th time The user id is not null # 8th time The user id is not null # 9th time The user id is not null # 10th time The user id is not null # 11th time The user id is null # 12th time
Here my session variable id dynamic not a static. But i want static value. I hope this is session problem. help me.
Thanks for you. bdeveloper01