Move method 'recover_documents_from_cache' from documentable controllers to document.
This commit is contained in:
@@ -21,6 +21,8 @@ class Document < ActiveRecord::Base
|
||||
validates :documentable_id, presence: true, if: -> { persisted? }
|
||||
validates :documentable_type, presence: true, if: -> { persisted? }
|
||||
|
||||
before_save :set_attachment_from_cached_attachment, if: -> { cached_attachment.present? }
|
||||
|
||||
def set_cached_attachment_from_attachment(prefix)
|
||||
self.cached_attachment = if Paperclip::Attachment.default_options[:storage] == :filesystem
|
||||
attachment.path
|
||||
|
||||
Reference in New Issue
Block a user