ruby-on-rails – Singleton不能被转储 – cached_resource gem
发布时间:2020-12-16 21:41:17 所属栏目:百科 来源:网络整理
导读:使用 cached_resource gem来缓存活动资源. 用户模型 class User ActiveResource::Base cached_resource class teachers SimpleDelegator attr_accessor :teacher_id def initialize(attributes = {},_persisted = true) @teacher_id = attributes['teacher_i
使用
cached_resource gem来缓存活动资源.
用户模型 class User < ActiveResource::Base cached_resource class teachers < SimpleDelegator attr_accessor :teacher_id def initialize(attributes = {},_persisted = true) @teacher_id = attributes['teacher_id'] super(User.find(@teacher_id)) end end end 我试图缓存用户资源. /用户/:USER_ID 每当我打电话/ users /:user_id endpoint它给我错误单例不能在行超级(User.find(@teacher_id))转储) 请建议是否有任何其他宝石可以帮助我缓存Activeresource呼叫. 解决方法
宝石的资源回应正在引发这个问题.这是让我的班级单身.因为这是通过单例转储错误.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |