class Document < ApplicationRecord belongs_to :user has_and_belongs_to_many :tags has_attached_file :doc, { 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 :doc, content_type: 'application/pdf' end