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.
Class Method Summary collapse
Instance Method Summary collapse
-
#attachment_changes ⇒ Object
:nodoc:.
-
#changed_for_autosave? ⇒ Boolean
:nodoc:.
-
#initialize_dup ⇒ Object
:nodoc:.
-
#reload ⇒ Object
:nodoc:.
Class Method Details
.validate_service_configuration(service_name, model_class, association_name) ⇒ Object
:nodoc:
263 264 265 266 267 268 269 270 271 |
# File 'lib/active_storage/attached/model.rb', line 263 def validate_service_configuration(service_name, model_class, association_name) # :nodoc: if service_name ActiveStorage::Blob.services.fetch(service_name) do raise ArgumentError, "Cannot configure service #{service_name.inspect} for #{model_class}##{association_name}" end else validate_global_service_configuration(model_class) end end |
Instance Method Details
#attachment_changes ⇒ Object
:nodoc:
281 282 283 |
# File 'lib/active_storage/attached/model.rb', line 281 def # :nodoc: @attachment_changes ||= {} end |
#changed_for_autosave? ⇒ Boolean
:nodoc:
285 286 287 |
# File 'lib/active_storage/attached/model.rb', line 285 def changed_for_autosave? # :nodoc: super || .any? end |
#initialize_dup ⇒ Object
:nodoc:
289 290 291 292 293 |
# File 'lib/active_storage/attached/model.rb', line 289 def initialize_dup(*) # :nodoc: super @active_storage_attached = nil @attachment_changes = nil end |
#reload ⇒ Object
:nodoc:
295 296 297 |
# File 'lib/active_storage/attached/model.rb', line 295 def reload(*) # :nodoc: super.tap { @attachment_changes = nil } end |