Sha256: 8091985bc7596d9bd0962aa4b6a650000492160442c81fbce8a37ab908f2cb40
Contents?: true
Size: 661 Bytes
Versions: 6
Compression:
Stored size: 661 Bytes
Contents
module Resque module Mailer module Serializers module ActiveRecordSerializer extend self def serialize(*args) args.map do |arg| if arg.is_a?(ActiveRecord::Base) { "class_name" => arg.class.name, "id" => arg.id } else arg end end end def deserialize(data) data.map do |arg| if arg.is_a?(Hash) && arg.has_key?("class_name") && arg.has_key?("id") arg["class_name"].constantize.find(arg["id"]) else arg end end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems