Module: ActiveStorage::Attached::Model

Extended by:
ActiveSupport::Concern
Defined in:
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

Instance Method Details

#attachment_changesObject

:nodoc:



262
263
264
# File 'lib/active_storage/attached/model.rb', line 262

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

#changed_for_autosave?Boolean

:nodoc:

Returns:

  • (Boolean)


266
267
268
# File 'lib/active_storage/attached/model.rb', line 266

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

#initialize_dupObject

:nodoc:



270
271
272
273
274
# File 'lib/active_storage/attached/model.rb', line 270

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

#reloadObject

:nodoc:



276
277
278
# File 'lib/active_storage/attached/model.rb', line 276

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