2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
class GroupLabel < Label
|
|
|
|
belongs_to :group
|
2022-11-25 23:54:43 +05:30
|
|
|
belongs_to :parent_container, foreign_key: :group_id, class_name: 'Group'
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
validates :group, presence: true
|
|
|
|
|
|
|
|
alias_attribute :subject, :group
|
|
|
|
|
2016-11-24 13:41:30 +05:30
|
|
|
def subject_foreign_key
|
|
|
|
'group_id'
|
|
|
|
end
|
2023-06-20 00:43:36 +05:30
|
|
|
|
|
|
|
def preloaded_parent_container
|
|
|
|
association(:group).loaded? ? group : parent_container
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|