@ -2,7 +2,7 @@ class Library < ActiveRecord::Base
include AASM
belongs_to :user
belongs_to :cover, class_name: 'Attachment', foreign_key: :cover_id
belongs_to :cover, class_name: 'Attachment', foreign_key: :cover_id, optional: true
has_many :library_applies, dependent: :delete_all
has_many :attachments, as: :container
@ -36,7 +36,7 @@ class Libraries::SaveService
def validate_params!
raise Error, '附件不能为空' if params[:attachment_ids].try(:compact).blank?
raise Error , '封面不能为空' if params[:cover_id].blank?
# raise Error , '封面不能为空' if params[:cover_id].blank?
end
def deal_library_tag!