开发者

Why does this hash syntax not work in Rails?

session[:user => user, :user_id => [user.id, user.salt]]

For some reason, that never worked for me.

T开发者_如何学Pythonhoughts on how I can achieve the following code in one line:

session[:user] = user
session[:user_id] = [user.id, user.salt]


Try

 session.merge({:user => user, :user_id => [user.id, user.salt]})


I stuck with the original syntax, because I couldn't find an alternative.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜