Class: ActiveStorage::Attached::Changes::DetachMany
- Inherits:
-
Object
- Object
- ActiveStorage::Attached::Changes::DetachMany
- Defined in:
- lib/active_storage/attached/changes/detach_many.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
- #detach ⇒ Object
-
#initialize(name, record, attachments) ⇒ DetachMany
constructor
A new instance of DetachMany.
Constructor Details
#initialize(name, record, attachments) ⇒ DetachMany
Returns a new instance of DetachMany.
7 8 9 |
# File 'lib/active_storage/attached/changes/detach_many.rb', line 7 def initialize(name, record, ) @name, @record, @attachments = name, record, end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
5 6 7 |
# File 'lib/active_storage/attached/changes/detach_many.rb', line 5 def @attachments end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/active_storage/attached/changes/detach_many.rb', line 5 def name @name end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
5 6 7 |
# File 'lib/active_storage/attached/changes/detach_many.rb', line 5 def record @record end |
Instance Method Details
#detach ⇒ Object
11 12 13 14 15 16 |
# File 'lib/active_storage/attached/changes/detach_many.rb', line 11 def detach if .any? .delete_all if .respond_to?(:delete_all) record..delete(name) end end |