Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何创建仅在用户登录 Devise 时才有效的变量?例如:我需要一个名为“current_location”的变量,该变量在用户下次登录时可能无效,因为该人可能会四处旅行。我不想将它保存在数据库中,因为其他用户可能使用相同的帐户登录。
提前致谢!
按要求:
你可以设置一个user_session[:current_location] = "Berlin, Germany". 它对于您的用户当前登录的机器应该是唯一的。
user_session[:current_location] = "Berlin, Germany"