lib/slices/asset/maker.rb in slices-1.0.5 vs lib/slices/asset/maker.rb in slices-2.0.0
- old
+ new
@@ -15,13 +15,13 @@
def create_new_asset
::Asset.create!(args)
end
def find_matching_asset(new_asset)
- ::Asset.first(conditions: {
+ ::Asset.where({
file_fingerprint: new_asset.file_fingerprint, :_id.ne => new_asset.id
- })
+ }).first
end
def tempfile_stored_on_s3?
Slices::Config.s3_storage? &&
args[:file].is_a?(URI)
@@ -42,10 +42,9 @@
delete_tempfile_from_s3 if tempfile_stored_on_s3?
matching_asset = find_matching_asset(new_asset)
if matching_asset.present?
new_asset.destroy
- matching_asset.soft_restore!
matching_asset
else
new_asset
end
end