Sha256: be2b11dcd10edf778954be7ccdbcacd3564ba60ec5e3136b464a240bf27527c6

Contents?: true

Size: 469 Bytes

Versions: 6

Compression:

Stored size: 469 Bytes

Contents

module Kuhsaft
  class ImageBrick < Brick
    attr_accessible :image, :caption, :href, :image_size
    mount_uploader :image, Kuhsaft::ImageBrickImageUploader

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

    before_save :resize_image_if_size_changed

    def resize_image_if_size_changed
      image.recreate_versions! if image_size_changed?
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kuhsaft-1.1.1 app/models/kuhsaft/image_brick.rb
kuhsaft-1.1.0 app/models/kuhsaft/image_brick.rb
kuhsaft-1.0.3 app/models/kuhsaft/image_brick.rb
kuhsaft-1.0.2 app/models/kuhsaft/image_brick.rb
kuhsaft-1.0.1 app/models/kuhsaft/image_brick.rb
kuhsaft-1.0.0 app/models/kuhsaft/image_brick.rb