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)


186
187
188
# File 'lib/active_shrine/model.rb', line 186

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

#initialize_dupObject

:nodoc:



190
191
192
193
194
# File 'lib/active_shrine/model.rb', line 190

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

#reloadObject

:nodoc:



196
197
198
# File 'lib/active_shrine/model.rb', line 196

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

#shrine_attachment_changesObject

:nodoc:



182
183
184
# File 'lib/active_shrine/model.rb', line 182

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