Sha256: 897036be610eb39f1f4358337a52b56b5df3f7cee13852cedde62f6db3df0e64

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 Bytes

Contents

# frozen_string_literal: true

class Image < ApplicationRecord
  include DynamicImage::Model
  include PagesCore::Sweepable

  validate :ensure_max_size, on: :create

  localizable do
    attribute :alternative
    attribute :caption
  end

  private

  def ensure_max_size
    return unless real_width? && real_height?
    return if real_width * real_height <= 48_000_000

    errors.add(:data, "is too large")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_core-3.15.5 app/models/image.rb