Sha256: 334d05951a715dbc9cc81f36a6a5ad0abaa24603516fa72f2b33a2e572643293
Contents?: true
Size: 983 Bytes
Versions: 9
Compression:
Stored size: 983 Bytes
Contents
# frozen_string_literal: true module CamaleonCms module CommonRelationships extend ActiveSupport::Concern included do class_name = name.demodulize has_many :metas, -> { where(object_class: class_name) }, class_name: 'CamaleonCms::Meta', foreign_key: :objectid, dependent: :destroy has_many :custom_field_values, -> { where(object_class: class_name) }, class_name: 'CamaleonCms::CustomFieldsRelationship', foreign_key: :objectid, dependent: :delete_all has_many :custom_fields, -> { where(object_class: class_name) }, class_name: 'CamaleonCms::CustomField', foreign_key: :objectid # valid only for simple groups and not for complex like: posts, post, ... where the group is for individual or # children groups has_many :custom_field_groups, -> { where(object_class: class_name) }, class_name: 'CamaleonCms::CustomFieldGroup', foreign_key: :objectid end end end
Version data entries
9 entries across 9 versions & 1 rubygems