[FIX]几处bug修复
This commit is contained in:
parent
a862d994ab
commit
aaa6483958
|
@ -11,9 +11,12 @@ class ApplySignaturesController < ApplicationController
|
|||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
@signature = current_user.apply_signatures.create!(project_id: params[:project_id])
|
||||
@signature = current_user.apply_signatures.find_or_create_by!(project_id: params[:project_id])
|
||||
@signature.status = 0
|
||||
@signature.attachments = Attachment.none
|
||||
@attachment = Attachment.find_by_id(params[:attachment_id])
|
||||
@attachment.container = @signature
|
||||
@signature.save!
|
||||
@attachment.save!
|
||||
rescue Exception => e
|
||||
tip_exception("#{e}")
|
||||
|
|
|
@ -23,5 +23,7 @@ class ApplySignature < ApplicationRecord
|
|||
|
||||
scope :with_user_id, -> (user_id) {where(user_id: user_id)}
|
||||
|
||||
validates :project_id, uniqueness: {scope: :user_id}
|
||||
|
||||
enum status: {unpassed: -1, waiting: 0, passed: 1}
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<td>
|
||||
<% if signature.attachments.present? %>
|
||||
<% signature.attachments.each do |attachment|%>
|
||||
<%= image_tag("/api/attachments/#{attachment.id}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %>
|
||||
<%= link_to "#{attachment.try(:filename)}",attachment_path(attachment), target: "_blank" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 6348a15cdb954862dc1b7b5f045a432bcfde7dc4
|
Loading…
Reference in New Issue