Sha256: 46e7aeaae8c109c14de0b6a40316265cbdc39a795fa246ad85983205aa5c7e20
Contents?: true
Size: 762 Bytes
Versions: 3
Compression:
Stored size: 762 Bytes
Contents
# frozen_string_literal: true module Katalyst module Content # STI base class for content items class Item < ApplicationRecord belongs_to :container, polymorphic: true validates :heading, presence: true validates :background, presence: true, inclusion: { in: Katalyst::Content.config.backgrounds } after_initialize :initialize_tree attr_accessor :parent, :children, :index, :depth def self.permitted_params %i[ container_type container_id type heading show_heading background visible ] end private def initialize_tree self.parent ||= nil self.children ||= [] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
katalyst-content-0.1.2 | app/models/katalyst/content/item.rb |
katalyst-content-0.1.1 | app/models/katalyst/content/item.rb |
katalyst-content-0.1.0 | app/models/katalyst/content/item.rb |