mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
fix image removing from tinymce
This commit is contained in:
parent
dec1e53b53
commit
e233fbe1d8
1 changed files with 7 additions and 1 deletions
|
@ -54,6 +54,12 @@ module TinyMceHelper
|
|||
end
|
||||
|
||||
def destroy_removed_tiny_mce_assets(ids, ref)
|
||||
ref.tiny_mce_assets.where.not('id IN (?)', ids).destroy_all
|
||||
# need to check if the array is empty because if we pass the empty array
|
||||
# in the SQL query it will not work properly
|
||||
if ids.empty?
|
||||
ref.tiny_mce_assets.destroy_all
|
||||
else
|
||||
ref.tiny_mce_assets.where.not('id IN (?)', ids).destroy_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue