Class: Spina::Attachment
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Spina::Attachment
- Includes:
- Attachable
- Defined in:
- app/models/spina/attachment.rb
Instance Attribute Summary collapse
-
#_destroy ⇒ Object
Returns the value of attribute _destroy.
Instance Method Summary collapse
Methods included from Attachable
Methods inherited from ApplicationRecord
Instance Attribute Details
#_destroy ⇒ Object
Returns the value of attribute _destroy.
5 6 7 |
# File 'app/models/spina/attachment.rb', line 5 def _destroy @_destroy end |
Instance Method Details
#content ⇒ Object
9 10 11 |
# File 'app/models/spina/attachment.rb', line 9 def content file if file.attached? end |
#old_update ⇒ Object
17 |
# File 'app/models/spina/attachment.rb', line 17 alias_method :old_update, :update |
#present? ⇒ Boolean
13 14 15 |
# File 'app/models/spina/attachment.rb', line 13 def present? signed_blob_id.present? end |
#update(attributes) ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/models/spina/attachment.rb', line 18 def update(attributes) if attributes["_destroy"] == "1" && attributes["file"].blank? page_part.destroy else old_update(attributes) end end |