Module: ActiveStorage::Attached::Model

Extended by:
ActiveSupport::Concern
Defined in:
activestorage/lib/active_storage/attached/model.rb

Overview

Active Storage Attached Model

Provides the class-level DSL for declaring an Active Record model’s attachments.

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included, prepend_features, prepended

Instance Method Details

#attachment_changesObject

:nodoc:



197
198
199
# File 'activestorage/lib/active_storage/attached/model.rb', line 197

def attachment_changes # :nodoc:
  @attachment_changes ||= {}
end

#changed_for_autosave?Boolean

:nodoc:

Returns:

  • (Boolean)


201
202
203
# File 'activestorage/lib/active_storage/attached/model.rb', line 201

def changed_for_autosave? # :nodoc:
  super || attachment_changes.any?
end

#initialize_dupObject

:nodoc:



205
206
207
208
209
# File 'activestorage/lib/active_storage/attached/model.rb', line 205

def initialize_dup(*) # :nodoc:
  super
  @active_storage_attached = nil
  @attachment_changes = nil
end

#reloadObject

:nodoc:



211
212
213
# File 'activestorage/lib/active_storage/attached/model.rb', line 211

def reload(*) # :nodoc:
  super.tap { @attachment_changes = nil }
end