Sha256: 93689226f3206df744fc4a04fc30c38374b0df44f0a06e71f61af5643cfe5b8c

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

module ConstructorPages
  module Types
    # Image type. Render select file field.
    class ImageType < ActiveRecord::Base
      extend Dragonfly::Model

      belongs_to :field
      belongs_to :page, touch: true

      dragonfly_accessor :value

      validates :value, presence: true
      # Max size is 5 MB
      validates_size_of :value, maximum: 5.megabytes, message: :incorrect_size
      # Accept only jpeg, png, gif
      validates_property :mime_type, of: :value, in: %w(image/jpeg image/png image/gif), message: :incorrect_format
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
constructor-pages-1.0.0beta2 app/models/constructor_pages/types/image_type.rb