Sha256: e5f4e1ce106105117fbd2bfbf7ca1d977810680b5a9a1f13b5fc1de46abefac3

Contents?: true

Size: 532 Bytes

Versions: 7

Compression:

Stored size: 532 Bytes

Contents

module Kuhsaft
  class ImageBrick < Brick
    mount_uploader :image, Kuhsaft::ImageBrickImageUploader

    validates :image, :presence => true
    validates :image_size, :presence => true

    after_save :resize_image_if_size_changed

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

    def collect_fulltext
      [super, caption].join(' ')
    end

    def user_can_add_childs?
      false
    end

    def image_present?
      image.present?
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kuhsaft-2.2.2 app/models/kuhsaft/image_brick.rb
kuhsaft-2.2.1 app/models/kuhsaft/image_brick.rb
kuhsaft-2.2.0 app/models/kuhsaft/image_brick.rb
kuhsaft-2.1.2 app/models/kuhsaft/image_brick.rb
kuhsaft-2.1.1 app/models/kuhsaft/image_brick.rb
kuhsaft-2.1.0 app/models/kuhsaft/image_brick.rb
kuhsaft-2.0.3 app/models/kuhsaft/image_brick.rb