Sha256: aa8afe4c968d13ce88a55efe32349a7cd6deec349c3929511b6148070f2b5453

Contents?: true

Size: 544 Bytes

Versions: 19

Compression:

Stored size: 544 Bytes

Contents

# encoding: utf-8

module ConstructorPages
  module Types
    # Image type. Render select file field.
    class ImageType < ActiveRecord::Base
      belongs_to :field
      belongs_to :page, touch: true

      image_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

19 entries across 19 versions & 1 rubygems

Version Path
constructor-pages-0.9.0 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.19 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.18 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.17 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.16 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.15 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.14 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.13 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.12 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.11 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.10 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.8 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.7 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.6 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.5 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.4 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.3 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.2 app/models/constructor_pages/types/image_type.rb
constructor-pages-0.8.1 app/models/constructor_pages/types/image_type.rb