Sha256: 4ccdafbc0fe3d3f50d026b0ccf230545b3cd9f7f626fc425983c3973edce8bef

Contents?: true

Size: 433 Bytes

Versions: 1

Compression:

Stored size: 433 Bytes

Contents

require 'administrate/field/base'
require 'rails'

module Administrate
  module Field
    class Carrierwave < Administrate::Field::Base
      class Engine < ::Rails::Engine; end

      delegate :url, :filename, to: :data, allow_nil: true

      def image
        options.fetch(:image, nil)
      end

      def uploaded?
        url.present?
      end

      def basename
        File.basename(data.path)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
administrate-field-carrierwave-0.0.3 lib/administrate/field/carrierwave.rb