From 5c9e995e56bfea00774e062e56de68121e64feaf Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Sat, 1 Oct 2016 13:23:04 +0200 Subject: [PATCH] Don't delete asset on locked --- app/models/asset.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/asset.rb b/app/models/asset.rb index aa583e160..f4f27ab6d 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -25,6 +25,7 @@ class Asset < ActiveRecord::Base do_not_validate_attachment_file_type :file before_file_post_process :allow_styles_on_images + before_destroy :check_if_locked # Asset validation # This could cause some problems if you create empty asset and want to @@ -452,4 +453,8 @@ class Asset < ActiveRecord::Base self.file = data end + + def check_if_locked + return false if locked? + end end