Sha256: 4630654c48caa4223c1d279289a15eefb0775b6ff2dbaf0c6c872b2a070fb376

Contents?: true

Size: 469 Bytes

Versions: 6

Compression:

Stored size: 469 Bytes

Contents

module Cardboard
  class Field::File < Field

    dragonfly_accessor :value

    validates_size_of :value, :maximum => 20.megabytes #20000.kilobytes #TODO: move size to gem settings
    validate :is_required #for some reason this is different from image

    def value
      return nil unless value_uid
      if value_uid =~ /^app\/assets\/files/
        Dragonfly.app.fetch_file(value_uid)
      else
        Dragonfly.app.fetch(value_uid)
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cardboard_cms-0.3.1 app/models/cardboard/field/file.rb
cardboard_cms-0.2.2 app/models/cardboard/field/file.rb
cardboard_cms-0.2.1 app/models/cardboard/field/file.rb
cardboard_cms-0.1.8 app/models/cardboard/field/file.rb
cardboard_cms-0.1.6 app/models/cardboard/field/file.rb
cardboard_cms-0.1.4 app/models/cardboard/field/file.rb