Sha256: 56ddcdba34a8ba710690dfb74de2ee44357f50095f307d05d9f4dfb17916ecea

Contents?: true

Size: 465 Bytes

Versions: 21

Compression:

Stored size: 465 Bytes

Contents

# frozen_string_literal: true

class PageImage < ApplicationRecord
  include PagesCore::Sweepable

  belongs_to :page
  belongs_to_image :image

  accepts_nested_attributes_for :image
  validates_associated :image

  acts_as_list scope: %i[page primary]

  localizable

  class << self
    def cleanup!
      all.find_each do |page_image|
        page_image.destroy unless page_image.image
      end
    end
  end

  def image
    super.localize!(locale)
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pages_core-3.12.7 app/models/page_image.rb
pages_core-3.12.6 app/models/page_image.rb
pages_core-3.12.5 app/models/page_image.rb
pages_core-3.12.4 app/models/page_image.rb
pages_core-3.12.3 app/models/page_image.rb
pages_core-3.12.2 app/models/page_image.rb
pages_core-3.12.1 app/models/page_image.rb
pages_core-3.12.0 app/models/page_image.rb
pages_core-3.11.3 app/models/page_image.rb
pages_core-3.11.2 app/models/page_image.rb
pages_core-3.11.1 app/models/page_image.rb
pages_core-3.11.0 app/models/page_image.rb
pages_core-3.10.2 app/models/page_image.rb
pages_core-3.10.1 app/models/page_image.rb
pages_core-3.9.2 app/models/page_image.rb
pages_core-3.9.1 app/models/page_image.rb
pages_core-3.9.0 app/models/page_image.rb
pages_core-3.8.3 app/models/page_image.rb
pages_core-3.8.2 app/models/page_image.rb
pages_core-3.8.1 app/models/page_image.rb