Module: ActiveStorage::Attached::Model

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

Overview

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:


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

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

#changed_for_autosave?Boolean

:nodoc:

Returns:

  • (Boolean)

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

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

#initialize_dupObject

:nodoc:


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

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

#reloadObject

:nodoc:


216
217
218
# File 'activestorage/lib/active_storage/attached/model.rb', line 216

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