Sha256: 42816a7405523b46093b69bb6b2cb6a556f6caa4636c2b4b431245972de88f22
Contents?: true
Size: 584 Bytes
Versions: 4
Compression:
Stored size: 584 Bytes
Contents
module SimpleRedisOrm class ApplicationEntry < Entry class << self attr_writer :model_name def new(id:, **attributes) super(id: redis_key(id), **attributes) end def create(id:, **attributes) super(id: redis_key(id), **attributes) end def find(id) super(redis_key(id)) end protected def model_name @model_name ||= (name || '').underscore end private def redis_key(id) id = without_redis_key_prefix(id) "#{model_name}:#{id}" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems