mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 12:56:27 +08:00
Files didn't get deleted in previous commit. [fixes SCI-1150]
This commit is contained in:
parent
e72184d10d
commit
1447a34dc7
1 changed files with 11 additions and 3 deletions
|
@ -68,7 +68,7 @@ class Asset < ActiveRecord::Base
|
|||
after_validation :filter_paperclip_errors
|
||||
# Needed because Paperclip validatates on creation
|
||||
after_initialize :filter_paperclip_errors, if: :new_record?
|
||||
before_destroy :paperlip_delete, prepend: true
|
||||
before_destroy :paperclip_delete, prepend: true
|
||||
|
||||
attr_accessor :file_content, :file_info, :preview_cached
|
||||
|
||||
|
@ -239,8 +239,9 @@ class Asset < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# Workaround for making Paperclip work with asset deletion
|
||||
def paperlip_delete
|
||||
# Workaround for making Paperclip work with asset deletion (might be because
|
||||
# of how the asset models are implemented)
|
||||
def paperclip_delete
|
||||
report_elements.destroy_all
|
||||
asset_text_datum.destroy if asset_text_datum.present?
|
||||
# Nullify needed to force paperclip file deletion
|
||||
|
@ -248,6 +249,13 @@ class Asset < ActiveRecord::Base
|
|||
save
|
||||
end
|
||||
|
||||
def destroy
|
||||
super()
|
||||
# Needed, otherwise the object isn't deleted, because of how the asset
|
||||
# models are implemented
|
||||
delete
|
||||
end
|
||||
|
||||
# If team is provided, its space_taken
|
||||
# is updated as well
|
||||
def update_estimated_size(team = nil)
|
||||
|
|
Loading…
Add table
Reference in a new issue