Sha256: 96d5f96f8c0391c5b0814bd58840861997ef7a0e7197b8e941408410de58cb15

Contents?: true

Size: 490 Bytes

Versions: 14

Compression:

Stored size: 490 Bytes

Contents

require 'carrierwave'
require 'active_support/concern'

module Kuhsaft
  module ImageUploaderMounting
    extend ActiveSupport::Concern

    included do
      extend CarrierWave::Mount

      mount_uploader :image, Kuhsaft::ImageBrickImageUploader

      after_save :resize_image_if_size_changed

      def resize_image_if_size_changed
        image.recreate_versions! if image_size_changed? && image_present?
      end

      delegate :present?, to: :image, prefix: true
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
kuhsaft-2.6.3 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.6.2 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.6.1 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.5.2 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.6.0 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.5.1 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.5.0 lib/kuhsaft/image_uploader_mounting.rb
qbrick-2.5.0.pre lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.4.3 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.4.2 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.4.1 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.4.0 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.3.6 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.3.5 lib/kuhsaft/image_uploader_mounting.rb