Sha256: e039b4588857942b3758de28d4ee5e5852feadac2524c6c62c2a621b860f3f9b
Contents?: true
Size: 512 Bytes
Versions: 71
Compression:
Stored size: 512 Bytes
Contents
# frozen_string_literal: true module ActiveStorage class Attached::Changes::DetachOne # :nodoc: attr_reader :name, :record, :attachment def initialize(name, record, attachment) @name, @record, @attachment = name, record, attachment end def detach if attachment.present? attachment.delete reset end end private def reset record.attachment_changes.delete(name) record.public_send("#{name}_attachment=", nil) end end end
Version data entries
71 entries across 68 versions & 6 rubygems