class Ckeditor::Picture < Ckeditor::Asset
  attr_accessor :data
  has_one_attached :storage_data

  validates :storage_data, file_content_type: { allow: /^image\/.*/ }, file_size: { less_than: 2.megabytes }

  def url_content
    rails_representation_url(storage_data.variant(resize: "800>").processed, only_path: true)
  end

  def url_thumb
    rails_representation_url(storage_data.variant(resize: "118x100").processed, only_path: true)
  end
end

class Ckeditor::Picture < Ckeditor::Asset
  attr_accessor :data
  has_one_attached :storage_data

  validates :storage_data, file_content_type: { allow: /^image\/.*/ }, file_size: { less_than: 2.megabytes }

  def url_content
    rails_representation_url(storage_data.variant(resize: "800>"), only_path: true)
  end

  def url_thumb
    rails_representation_url(storage_data.variant(resize: "118x100"), only_path: true)
  end
end

Fix deleted file case in CKEditor
Fix deleted file case in CKEditor

We were getting an error when browsing the server if one file had been
deleted.
