Browse Source

fixed 发行版附件关联

pull/347/head
xxq250 2 years ago
parent
commit
9a0809e45b
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      app/controllers/version_releases_controller.rb

+ 2
- 1
app/controllers/version_releases_controller.rb View File

@@ -152,11 +152,12 @@ class VersionReleasesController < ApplicationController

def create_attachments(attachment_ids, target)
attachment_ids.each do |id|
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
attachment = Attachment.select(:id, :container_id, :container_type).where(id: id).or(Attachment.where(uuid: id))&.first
unless attachment.blank?
attachment.container = target
attachment.author_id = current_user.id
attachment.description = ""
attachment.uuid = SecureRandom.uuid
attachment.save
end
end


Loading…
Cancel
Save