galetahub/ckeditor

View on GitHub
lib/generators/ckeditor/templates/mongoid/shrine/ckeditor/attachment_file.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module Ckeditor
  class AttachmentFileUploader < Shrine
    plugin :validation_helpers

    Attacher.validate do
      validate_max_size 100.megabytes
    end
  end

  class AttachmentFile < Ckeditor::Asset
    include AttachmentFileUploader.attachment(:data)

    validates :data, presence: true

    def url_thumb
      @url_thumb ||= Ckeditor::Utils.filethumb(filename)
    end
  end
end