【发布时间】:2022-01-16 21:13:29
【问题描述】:
想要实现
Ruby 2.6.5
Ruby on Rails 6.0.3
感谢您的光临!
我正在用 Ruby on Rails 创建一个应用程序。
我也在使用 devise 来建立登录关系。
突然出现以下错误:
ActionDispatch::Cookies::CookieOverflow (ActionDispatch::Cookies::CookieOverflow)
错误信息说cookie太多,所以我查看了session的内容。
session.to_hash
=> {"session_id"=>"4ceff7435d264fb8f7b41bacb8f2ba06",
"_csrf_token"=>"zrbECxocvrrdIRD85hABDE18kRwiIttAP2B3hvbkeuk=",
"warden.user.user.key"=>
#<User id: 160, email: "sbxtestmike+latest3@gmail.com", last_name: "test_lastname", first_name: "test_firstname", profile: "In the event that you're looking for the best way to get the most out of your business, you'll be able to get the most..."}
似乎当用户配置文件中有大量数据时会发生此错误。所以我想避免只在会话中存储配置文件。
我不知道在哪里解决这个问题。
如果你能给我一些提示或想法,我很乐意听到。
这是我认为相关的代码。
def verify
prms = verify_params
logger.debug 'success'
sign_in(:user, @user)
@resource = @user
@resource.tokens = nil
@token = @resource.create_token
@resource.save!
auth_header = @resource.build_auth_header(@token.token, @token.client)
response.headers.merge!(auth_header)
end
end
【问题讨论】:
标签: ruby-on-rails cookies devise