Sha256: cb9fd518822e1fef2a47329cf87d0db44b3f8744903801ac5c71e0b9f873028f
Contents?: true
Size: 975 Bytes
Versions: 25
Compression:
Stored size: 975 Bytes
Contents
# frozen_string_literal: true module Alchemy module Admin module UploaderResponses extend ActiveSupport::Concern def successful_uploader_response(file:, status: :created) message = Alchemy.t(:upload_success, scope: [:uploader, file.class.model_name.i18n_key], name: file.name) { json: uploader_response(file: file, message: message), status: status } end def failed_uploader_response(file:) message = Alchemy.t(:upload_failure, scope: [:uploader, file.class.model_name.i18n_key], error: file.errors[:file].join, name: file.name) { json: uploader_response(file: file, message: message), status: :unprocessable_entity } end private def uploader_response(file:, message:) { files: [file.to_jq_upload], message: message } end end end end
Version data entries
25 entries across 25 versions & 1 rubygems