1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

Merge pull request #480 from TMaYaD/patch-1

Avoid looking up item when reifying with dup: true
This commit is contained in:
Ben Atkins 2015-02-03 16:50:39 -05:00
commit 1c535b24ca

View file

@ -165,7 +165,7 @@ module PaperTrail
# `item_type` will be the base class, not the actual subclass. # `item_type` will be the base class, not the actual subclass.
# If `type` is present but empty, the class is the base class. # If `type` is present but empty, the class is the base class.
if item && options[:dup] != true if options[:dup] != true && item
model = item model = item
# Look for attributes that exist in the model and not in this version. These attributes should be set to nil. # Look for attributes that exist in the model and not in this version. These attributes should be set to nil.
(model.attribute_names - attrs.keys).each { |k| attrs[k] = nil } (model.attribute_names - attrs.keys).each { |k| attrs[k] = nil }