Sha256: e16c5393aea430033a1fe18bc938733bce2271954957802840959e592d0860a4
Contents?: true
Size: 634 Bytes
Versions: 3
Compression:
Stored size: 634 Bytes
Contents
if defined?(ActiveRecord) class ActiveRecord::Base yaml_as "tag:ruby.yaml.org,2002:ActiveRecord" def self.yaml_new(klass, tag, val) if ActiveRecord::VERSION::MAJOR == 3 klass.unscoped.find(val['attributes'][klass.primary_key]) else # Rails 2 klass.with_exclusive_scope { klass.find(val['attributes'][klass.primary_key]) } end rescue ActiveRecord::RecordNotFound raise Delayed::DeserializationError, "ActiveRecord::RecordNotFound, class: #{klass} , primary key: #{val['attributes'][klass.primary_key]} " end def to_yaml_properties ['@attributes'] end end end
Version data entries
3 entries across 3 versions & 2 rubygems