module Amendmenable extend ActiveSupport::Concern included do include ActiveStorageSupport::SupportForBase64 has_one_base64_attached :amendment_signature end def amendment_signable? if contract_template.present? contract_template.amendment_clause.present? else false end end def amendment_signed? amendment_signature.attached? end def amendment_signature_base64 nil end def amendment_signature_base64=(data_uri) return if data_uri.blank? amendment_signature.attach(data: data_uri, filename: "amendment_signature.png", content_type: "image/png", identify: "false") end end