Sha256: cbcf45f4807a683706dd5b7c6c75d51deb7de966159e742179f5108b084f7413

Contents?: true

Size: 630 Bytes

Versions: 8

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true
module C
  class Slideshow < ApplicationRecord
    scope :ordered, -> { order created_at: :asc }

    has_many :slides, dependent: :delete_all

    before_validation on: :create do
      self.machine_name = name
    end

    # Force non blank parametized machine name
    def machine_name=(val)
      super val.to_s.parameterize
    end

    INDEX_TABLE = {
      'Name': { link: { name: { call: 'name' }, options: '[:edit, object]' } },
      'Description': { call: 'body&.html_safe' },
      'Slides': { link: { name: { call: 'slides.count' }, options: '[:edit, object]' } }
    }.freeze
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cd2_catton_cms-1.1.35 app/models/c/slideshow.rb
cd2_catton_cms-1.1.34 app/models/c/slideshow.rb
cd2_catton_cms-1.1.33 app/models/c/slideshow.rb
cd2_catton_cms-1.1.32 app/models/c/slideshow.rb
cd2_catton_cms-1.1.31 app/models/c/slideshow.rb
cd2_catton_cms-1.1.30 app/models/c/slideshow.rb
cd2_catton_cms-1.1.20 app/models/c/slideshow.rb
cd2_catton_cms-1.1.10 app/models/c/slideshow.rb