Prod build process
This commit is contained in:
@@ -13,19 +13,19 @@ module IdCard
|
||||
|
||||
def create
|
||||
file = logo_params["logo_file"]
|
||||
if file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
employer_id = logo_params["employer_id"]
|
||||
employer = Employer.find(employer_id)
|
||||
setup = employer.id_card_setup
|
||||
if setup.present? && file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
filename = file.original_filename
|
||||
# binary_data = file.read
|
||||
binary_data = File.binread(file)
|
||||
meme_type = Marcel::MimeType.for(file)
|
||||
|
||||
employerlogo = IdCard::EmployerLogo.create(
|
||||
filename: filename,
|
||||
image_data: binary_data,
|
||||
content_type: meme_type
|
||||
)
|
||||
employer_logo = IdCard::EmployerLogo.find_or_create_by(filename: filename, setup_id: setup.id)
|
||||
employer_logo.update(image_data: binary_data)
|
||||
|
||||
render json: employerlogo, only: [:id], status: :ok
|
||||
render json: employer_logo, only: [:id], status: :ok
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ module IdCard
|
||||
private
|
||||
|
||||
def logo_params
|
||||
params.require(:id_card_employer_logo).permit(:logo_file)
|
||||
params.require(:id_card_employer_logo).permit(:logo_file, :employer_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user