开发者

Why does this hash syntax not work in Rails?

开发者 https://www.devze.com 2023-01-22 03:01 出处:网络
session[:user => user, :user_id => [user.id, user.salt]] For some reason, that never worked for me.
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

精彩评论

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