mhgbrown / cached_resource

Caching for ActiveResource
MIT License
80 stars 28 forks source link

singleton can't be dumped #23

Open pardeepdhingra-zz opened 9 years ago

pardeepdhingra-zz commented 9 years ago

Using cached_resource gem for caching active resources.

User model

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

I am trying to cache user resources.

/users/:user_id

Whenever i am calling /users/:user_id endpoint it gives me error singleton can't be dumped at line super(User.find(@teacher_id))

Please let me know if any other info is required. I am stucked with it, please help me out.

mhgbrown commented 9 years ago

I am wondering if maybe you are encountering something similar to this? https://github.com/Ahsizara/cached_resource/issues/7