Class: Spina::Attachment
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Spina::Attachment
- Defined in:
- app/models/spina/attachment.rb
Instance Attribute Summary collapse
-
#_destroy ⇒ Object
Returns the value of attribute _destroy.
Instance Method Summary collapse
Instance Attribute Details
#_destroy ⇒ Object
Returns the value of attribute _destroy.
9 10 11 |
# File 'app/models/spina/attachment.rb', line 9 def _destroy @_destroy end |
Instance Method Details
#content ⇒ Object
17 18 19 |
# File 'app/models/spina/attachment.rb', line 17 def content file if file.attached? end |
#name ⇒ Object
13 14 15 |
# File 'app/models/spina/attachment.rb', line 13 def name file.filename.to_s end |
#old_update ⇒ Object
21 |
# File 'app/models/spina/attachment.rb', line 21 alias_method :old_update, :update |
#update(attributes) ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/models/spina/attachment.rb', line 22 def update(attributes) if attributes["_destroy"] == "1" && attributes["file"].blank? self.page_part.destroy else old_update(attributes) end end |