Module: ActiveStorage::Attached::Model

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

Overview

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

Instance Method Summary collapse

Instance Method Details

#attachment_changesObject

:nodoc:



222
223
224
# File 'lib/active_storage/attached/model.rb', line 222

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

#changed_for_autosave?Boolean

:nodoc:

Returns:

  • (Boolean)


226
227
228
# File 'lib/active_storage/attached/model.rb', line 226

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

#initialize_dupObject

:nodoc:



230
231
232
233
234
# File 'lib/active_storage/attached/model.rb', line 230

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

#reloadObject

:nodoc:



236
237
238
# File 'lib/active_storage/attached/model.rb', line 236

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