Sha256: a8a779f48f49643555f7d661578dd7369597172e28e13fabc04620fa5f4fa1f7
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true class Organization < ApplicationRecord has_many :children, class_name: 'Organization', foreign_key: :parent_id belongs_to :parent, class_name: 'Organization' has_many :assignments has_many :people, class_name: 'Namespaced::Person', through: :assignments belongs_to :area global_registry_bindings id_column: :gr_id, type: ->(_model) { :fancy_org }, push_on: %i[create destroy], parent_association: :parent, exclude_fields: :exclude_gr_fields, extra_fields: proc { |_type, _model| {} } global_registry_bindings binding: :relationship, type: :area, id_column: :global_registry_area_id, related_association: :area, exclude_fields: proc { |_type, _model| %i[] }, extra_fields: proc { |_type, _model| { priority: :string } } def exclude_gr_fields(_type) %i[id created_at updated_at gr_id parent_id area_id global_registry_area_id] end def relationship_attributes_to_push(type) entity_attributes = super(type) entity_attributes[:priority] = 'High' if type == :area entity_attributes end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
global-registry-bindings-0.1.1 | spec/internal/app/models/organization.rb |
global-registry-bindings-0.1.0 | spec/internal/app/models/organization.rb |