Sha256: 1f149efbc52a69744a33ce6216716a187889fa69177deee096f656bd7cad7876

Contents?: true

Size: 739 Bytes

Versions: 11

Compression:

Stored size: 739 Bytes

Contents

class Image < ActiveRecord::Base
  ALLOWED_MIME_TYPES = ['image/jpeg', 'image/jpg', 'image/png', 'image/gif']
  ALLOWED_EXTENSIONS = [:jpeg, :jpg, :png, :JPEG, :JPG, :PNG]

  image_accessor :image # accessor to image_uid

  validates :image, :presence => true, :on => :create
  validates :image, :length => { :maximum => 6.megabytes }

  # Dragonfly custom validators for image
  # see: github.com/markevans/dragonfly
  validates_property :format,    :of => :image, :in => ALLOWED_EXTENSIONS
  validates_property :mime_type, :of => :image, :in => ALLOWED_MIME_TYPES
  validates_property :width,     :of => :image, :in => (150..3000)
  validates_property :height,    :of => :image, :in => (150..3000)

  default_scope order(:updated_at)
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
imperavi-rails-0.0.12.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.11.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.10.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.9.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.8.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.7.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.6.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.5.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.4.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.3.beta spec/dummy/app/models/image.rb
imperavi-rails-0.0.2.beta spec/dummy/app/models/image.rb