解决方法
至少在我的系统(rails 3.2,devise 2.0.4)上,你可以这样做:
会话是:
{"session_id"=>"be02f27d504672bab3408a0ccf5c1db5","_csrf_token"=>"DKaCNX3/DMloaCHbVSNq33NJjYIg51X0z/p2T1VRzfY=","warden.user.user.key"=>["User",[3],"$2a$10$5HFWNuz5p6fT3Z4ZvJfQq."]}
session [“warden.user.user.key”] [1] [0],那么是3.
所以,我会发现:
User.find(session["warden.user.user.key"][1][0])