mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
26 lines
732 B
Ruby
26 lines
732 B
Ruby
class Siblingship < ApplicationRecord
|
|
include HasContentLinking
|
|
LINK_TYPE = :two_way
|
|
|
|
belongs_to :user, optional: true
|
|
|
|
belongs_to :character
|
|
belongs_to :sibling, class_name: 'Character', optional: true
|
|
|
|
# after_create do
|
|
# self.reciprocate(
|
|
# relation: :siblingships,
|
|
# parent_object_ref: :character,
|
|
# added_object_ref: :sibling
|
|
# )
|
|
# end
|
|
|
|
# after_destroy do
|
|
# # This is a two-way relation, so we should also delete the reverse association
|
|
# this_object = Character.find_by(id: self.character_id)
|
|
# other_object = Character.find_by(id: self.sibling_id)
|
|
|
|
# other_object.siblings.delete(this_object) if other_object.present? && this_object.present?
|
|
# end
|
|
end
|