Sha256: d493167b4ecab3a97666a8675ff40959b8e508cb0a220b19c4335b08eef1d5f3

Contents?: true

Size: 642 Bytes

Versions: 5

Compression:

Stored size: 642 Bytes

Contents

require 'file_size_validator'

module Fae
  class Image < ActiveRecord::Base

    include Fae::BaseModelConcern
    include Fae::ImageConcern
    include Fae::AssetsValidatable

    attr_accessor :redirect
    mount_uploader :asset, Fae::ImageUploader

    after_save :recreate_versions

    validates :asset,
      file_size: {
        maximum: Fae.max_image_upload_size.megabytes.to_i
      }

    belongs_to :imageable, polymorphic: true, touch: true, optional: true

    def readonly?
      false
    end

    private

    def recreate_versions
      asset.recreate_versions! if Fae.recreate_versions && asset.present?
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
fae-rails-3.0.0 app/models/fae/image.rb
fae-rails-2.2.0 app/models/fae/image.rb
fae-rails-2.1.0 app/models/fae/image.rb
fae-railsz-2.1.0 app/models/fae/image.rb
fae-rails-2.0.0 app/models/fae/image.rb