Sha256: 879372170696e0a961c719ead7143cf050e618b75374245412634e8a104e737f
Contents?: true
Size: 893 Bytes
Versions: 36
Compression:
Stored size: 893 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.respond_to?(:searchable?) && parent.searchable? end def parent row.rowable end end
Version data entries
36 entries across 36 versions & 1 rubygems