Sha256: 40b8c4855ef7308dc163a72d3eff14bd8d5519eaf60c8fbad90eee8ddf56ceb0
Contents?: true
Size: 592 Bytes
Versions: 5
Compression:
Stored size: 592 Bytes
Contents
# -*- encoding : utf-8 -*- module RecordMarshal class << self # dump ActiveRecord instace with only attributes. # ["User", # {"id"=>30, # "email"=>"dddssddd@gmail.com", # "created_at"=>2012-07-25 18:25:57 UTC # } # ] def dump(record) [ record.class.name, record.instance_variable_get(:@attributes) ] end # load a cached record def load(serialized) return unless serialized record = serialized[0].constantize.allocate record.init_with('attributes' => serialized[1]) record end end end
Version data entries
5 entries across 5 versions & 3 rubygems