Sha256: 3c3f98eb19b23c0337ded998b455929aa35b104dac36bc939e43f11d745b6ac5

Contents?: true

Size: 497 Bytes

Versions: 9

Compression:

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

      def image_present?
        image.present?
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kuhsaft-2.3.4 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.3.3 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.3.2 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.3.1 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.3.0 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.2.6 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.2.5 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.2.4 lib/kuhsaft/image_uploader_mounting.rb
kuhsaft-2.2.3 lib/kuhsaft/image_uploader_mounting.rb