Sha256: 71aedcf896a31833856bce8d155a8ce6617bbfa8cd278781cd27649e21ac16d5
Contents?: true
Size: 526 Bytes
Versions: 1
Compression:
Stored size: 526 Bytes
Contents
class Polutan < ActiveEntity::Base attr_accessor :id def initialize(attributes={}) super unless @id @id = SecureRandom.uuid save end end def []=(attr_name, value) super save end def save Kredis.json("#{self.class.name}:#{@id}").value = self.attributes.to_json changes_applied end def self.find(id) raise ArgumentError unless id json = Kredis.json("#{name}:#{id}").value raise ActiveRecord::RecordNotFound unless json new json.merge(id: id) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polutan-1.0.2 | lib/polutan/polutan.rb |