You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
664 B
21 lines
664 B
class Tiding < ApplicationRecord
|
|
belongs_to :user
|
|
belongs_to :trigger_user, class_name: 'User', optional: true
|
|
belongs_to :container, polymorphic: true, optional: true
|
|
belongs_to :parent_container, polymorphic: true, optional: true
|
|
belongs_to :belong_container, polymorphic: true, optional: true
|
|
|
|
has_many :attachments, as: :container
|
|
|
|
def identifier
|
|
value = nil
|
|
if Object.const_defined?(container_type)
|
|
value = container.try(:identifier)
|
|
end
|
|
|
|
if value.blank? && belong_container_type && Object.const_defined?(belong_container_type)
|
|
value = belong_container.try(:identifier)
|
|
end
|
|
value
|
|
end
|
|
end |