class PagePreview < ApplicationRecord belongs_to :content has_attached_file :preview, { adapter_options: { hash_digest: Digest::SHA256 }, url: "/system/:class/:attachment/:id_partition/:style/:hash.:extension", hash_secret: Rails.application.secrets.secret_key_base } validates_attachment_content_type :preview, content_type: 'image/png' end