Sha256: 0592ab9f18b823733e93c5a637b2b4ed1135685b4e83e8ae2effb4d72f75b005

Contents?: true

Size: 587 Bytes

Versions: 8

Compression:

Stored size: 587 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

    private

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

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fae-rails-1.4.1 app/models/fae/image.rb
fae-rails-1.4.0 app/models/fae/image.rb
fae-rails-1.3.1 app/models/fae/image.rb
fae-rails-1.3.0 app/models/fae/image.rb
fae-rails-1.2.5 app/models/fae/image.rb
fae-rails-1.2.4 app/models/fae/image.rb
fae-rails-1.2.3 app/models/fae/image.rb
fae-rails-1.2.2 app/models/fae/image.rb