class ActiveSupport::EncryptedFile
def writing(contents)
def writing(contents) Tempfile.create(["", "-" + content_path.basename.to_s.chomp(".enc")]) do |tmp_file| tmp_path = Pathname.new(tmp_file) tmp_path.binwrite contents yield tmp_path updated_contents = tmp_path.binread write(updated_contents) if updated_contents != contents end end