Adjust filename obfuscation to be able to remove cached uploads

This commit is contained in:
Senén Rodero Rodríguez
2017-09-21 11:12:10 +02:00
parent 6d5571b177
commit fe7b0edb38
2 changed files with 5 additions and 3 deletions

View File

@@ -1,8 +1,9 @@
class Document < ActiveRecord::Base class Document < ActiveRecord::Base
include DocumentsHelper include DocumentsHelper
include DocumentablesHelper include DocumentablesHelper
has_attached_file :attachment, path: ":rails_root/public/system/:class/:prefix/:style/:hash.:extension", has_attached_file :attachment, url: "/system/:class/:prefix/:style/:hash.:extension",
url: "/system/:class/:prefix/:style/:hash.:extension", hash_data: ":class/:style",
use_timestamp: false,
hash_secret: Rails.application.secrets.secret_key_base hash_secret: Rails.application.secrets.secret_key_base
attr_accessor :cached_attachment attr_accessor :cached_attachment

View File

@@ -8,8 +8,9 @@ class Image < ActiveRecord::Base
ACCEPTED_CONTENT_TYPE = %w(image/jpeg image/jpg) ACCEPTED_CONTENT_TYPE = %w(image/jpeg image/jpg)
has_attached_file :attachment, styles: { large: "x#{MIN_SIZE}", medium: "300x300#", thumb: "140x245#" }, has_attached_file :attachment, styles: { large: "x#{MIN_SIZE}", medium: "300x300#", thumb: "140x245#" },
path: ":rails_root/public/system/:class/:prefix/:style/:hash.:extension",
url: "/system/:class/:prefix/:style/:hash.:extension", url: "/system/:class/:prefix/:style/:hash.:extension",
hash_data: ":class/:style",
use_timestamp: false,
hash_secret: Rails.application.secrets.secret_key_base hash_secret: Rails.application.secrets.secret_key_base
attr_accessor :cached_attachment attr_accessor :cached_attachment