def create
user = User.find_by_email(params[:email])
if user && user.authenticate(params[:password])
session[:foo] = "bar"
session[:user_id] = user.id
redirect_to root_url, notice: "Signed in!"
else
flash.now[:error] = "Email or password is invalid."
render "new"
end
end
当我解码 base64 cookie 时,我得到:
{I"session_id:EFI"%14cd484a34917f7d923ef8222c16e0e1;TI"foo;FI"bar;FI"_csrf_token;FI"1ajWlOZok1Amp8Nh9uOdUWzeM20b873zocEbyiR+b1ao=;FI"user_id;Fi }
为什么 mysession[:foo]
设置但不是 my session[:user_id]
?