Module: ActiveShrine::Model

Extended by:
ActiveSupport::Concern
Includes:
Reflection::ActiveRecordExtensions
Defined in:
lib/active_shrine/model.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#changed_for_autosave?Boolean

:nodoc:

Returns:

  • (Boolean)


260
261
262
# File 'lib/active_shrine/model.rb', line 260

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

#initialize_dupObject

:nodoc:



264
265
266
267
268
# File 'lib/active_shrine/model.rb', line 264

def initialize_dup(*) # :nodoc:
  super
  @active_shrine_attached = nil
  @shrine_attachment_changes = nil
end

#reloadObject

:nodoc:



270
271
272
# File 'lib/active_shrine/model.rb', line 270

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

#shrine_attachment_changesObject

:nodoc:



256
257
258
# File 'lib/active_shrine/model.rb', line 256

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