Class: Spina::Attachment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- 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.
7 8 9 |
# File 'app/models/spina/attachment.rb', line 7 def _destroy @_destroy end |
Instance Method Details
#name ⇒ Object
14 15 16 |
# File 'app/models/spina/attachment.rb', line 14 def name file.file.try(:filename) end |
#old_update_attributes ⇒ Object
18 |
# File 'app/models/spina/attachment.rb', line 18 alias_method :old_update_attributes, :update_attributes |
#update_attributes(attributes) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/models/spina/attachment.rb', line 19 def update_attributes(attributes) if attributes["_destroy"] == "1" && attributes["file"].blank? self.page_part.destroy else old_update_attributes(attributes) end end |