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:



194
195
196
# File 'lib/active_storage/attached/model.rb', line 194

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

#changed_for_autosave?Boolean

:nodoc:

Returns:

  • (Boolean)


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

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

#initialize_dupObject

:nodoc:



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

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

#reloadObject

:nodoc:



208
209
210
# File 'lib/active_storage/attached/model.rb', line 208

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