|
|
|
@ -115,7 +115,7 @@ class Attachment < ApplicationRecord
|
|
|
|
|
|
|
|
|
|
def become_history
|
|
|
|
|
history = self.attachment_histories.first
|
|
|
|
|
new_attachment_history = AttachmentHistory.new(self.attributes.except("id", "resource_bank_id", "unified_setting", "course_second_category_id", "delay_publish").merge(
|
|
|
|
|
new_attachment_history = AttachmentHistory.new(self.attributes.except("id", "resource_bank_id", "unified_setting", "course_second_category_id", "delay_publish", "link").merge(
|
|
|
|
|
attachment_id: self.id,
|
|
|
|
|
version: history.nil? ? 1 : history.version + 1,
|
|
|
|
|
))
|
|
|
|
@ -123,7 +123,7 @@ class Attachment < ApplicationRecord
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def copy_attributes_from_new_attachment(new_attachment)
|
|
|
|
|
self.attributes = new_attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes",'is_publish','publish_time', "delay_publish")
|
|
|
|
|
self.attributes = new_attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes",'is_publish','publish_time', "delay_publish", "link")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def set_public(is_public)
|
|
|
|
|