Sha256: 2082f8943496f77a8d0ea84cc67cbff9646cd1f4c775af0744c28cb356441dd3

Contents?: true

Size: 502 Bytes

Versions: 4

Compression:

Stored size: 502 Bytes

Contents

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

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

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

      def multiple?
        options.fetch(:multiple, false)
      end

      # One-element array when single file field, array of files when multiple
      def files
        Array[*data]
      end

      def file
        files.first
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
administrate-field-carrierwave-0.1.3 lib/administrate/field/carrierwave.rb
administrate-field-carrierwave-0.1.2 lib/administrate/field/carrierwave.rb
administrate-field-carrierwave-0.1.1 lib/administrate/field/carrierwave.rb
administrate-field-carrierwave-0.1.0 lib/administrate/field/carrierwave.rb