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
- #content ⇒ Object
- #name ⇒ Object
- #old_update_attributes ⇒ Object
- #update_attributes(attributes) ⇒ Object
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_attributes ⇒ Object
21 |
# File 'app/models/spina/attachment.rb', line 21 alias_method :old_update_attributes, :update_attributes |
#update_attributes(attributes) ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/models/spina/attachment.rb', line 22 def update_attributes(attributes) if attributes["_destroy"] == "1" && attributes["file"].blank? self.page_part.destroy else old_update_attributes(attributes) end end |