diff --git a/app/models/document.rb b/app/models/document.rb index 0bd41d673..ff19cf390 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -1,8 +1,9 @@ class Document < ActiveRecord::Base include DocumentsHelper include DocumentablesHelper - has_attached_file :attachment, path: ":rails_root/public/system/:class/:prefix/:style/:hash.:extension", - url: "/system/:class/:prefix/:style/:hash.:extension", + has_attached_file :attachment, url: "/system/:class/:prefix/:style/:hash.:extension", + hash_data: ":class/:style", + use_timestamp: false, hash_secret: Rails.application.secrets.secret_key_base attr_accessor :cached_attachment diff --git a/app/models/image.rb b/app/models/image.rb index 358453385..da305957e 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -8,8 +8,9 @@ class Image < ActiveRecord::Base ACCEPTED_CONTENT_TYPE = %w(image/jpeg image/jpg) 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", + hash_data: ":class/:style", + use_timestamp: false, hash_secret: Rails.application.secrets.secret_key_base attr_accessor :cached_attachment