def restore
      restore_class = self.trashable_type.constantize
    
      sti_type = self.trashable_attributes[restore_class.inheritance_column]
      if sti_type
        begin
          if !restore_class.store_full_sti_class && !sti_type.start_with?("::")
            sti_type = "#{restore_class.parent.name}::#{sti_type}"
          end
          restore_class = sti_type.constantize
        rescue NameError => e
          raise e
          # Seems our assumption was wrong and we have no STI
        end
      end
    
      attrs, association_attrs = attributes_and_associations(restore_class, self.trashable_attributes)
    
      record = restore_class.new
      attrs.each_pair do |key, value|
        record.send("#{key}=", value)
      end
    
      association_attrs.each_pair do |association, attribute_values|
        restore_association(record, association, attribute_values)
      end
    
      return record
    end
def restore
      restore_class = self.trashable_type.constantize
    
      sti_type = self.trashable_attributes[restore_class.inheritance_column]
      if sti_type
        begin
          if !restore_class.store_full_sti_class && !sti_type.start_with?("::")
            sti_type = "#{restore_class.parent.name}::#{sti_type}"
          end
          restore_class = sti_type.constantize
        rescue NameError => e
          raise e
          # Seems our assumption was wrong and we have no STI
        end
      end
    
      attrs, association_attrs = attributes_and_associations(restore_class, self.trashable_attributes)
    
      record = restore_class.new
      attrs.each_pair do |key, value|
        record.send("#{key}=", value)
      end
    
      association_attrs.each_pair do |association, attribute_values|
        restore_association(record, association, attribute_values)
      end
    
      return record
    end
Create a new trash record for the provided record.
 Restore a trashed record into an object. The record will not be saved.