Sha256: 5a2d02c89c2d0a4470e41a20ef2761bce6f5819497e5c16d71d81f69a369c9b7
Contents?: true
Size: 857 Bytes
Versions: 16
Compression:
Stored size: 857 Bytes
Contents
class ContentColumn < ApplicationRecord include Concerns::Sortable sortable(scope: :row_id) # Removing a column from a searchable object should remove the linked # SearchIndex instance. after_destroy do next unless linked_to_searchable_parent? parent.search_indices.where(name: "flexible_content:#{content_id}").destroy_all end belongs_to :row, class_name: 'ContentRow', touch: true belongs_to :content, polymorphic: true, dependent: :destroy default_scope -> { order(:position) } validates :row, presence: true validates :width_xs, :width_sm, :width_md, :width_lg, :width_xl, presence: true, numericality: { greater_than: 0, less_than_or_equal_to: 12, only_integer: true } def linked_to_searchable_parent? parent.present? && parent.searchable? end def parent row.rowable end end
Version data entries
16 entries across 16 versions & 1 rubygems