Sha256: e3d61503c8682edf119f2a2d68e0a1409316e0f23b5c022f6fe1843417163c07
Contents?: true
Size: 921 Bytes
Versions: 22
Compression:
Stored size: 921 Bytes
Contents
class ManifestationRelationship < ApplicationRecord belongs_to :parent, foreign_key: 'parent_id', class_name: 'Manifestation' belongs_to :child, foreign_key: 'child_id', class_name: 'Manifestation' belongs_to :manifestation_relationship_type, optional: true validate :check_parent validates_presence_of :parent_id, :child_id acts_as_list scope: :parent_id def check_parent if parent_id == child_id errors.add(:parent) errors.add(:child) end end end # == Schema Information # # Table name: manifestation_relationships # # id :integer not null, primary key # parent_id :integer # child_id :integer # manifestation_relationship_type_id :integer # created_at :datetime # updated_at :datetime # position :integer #
Version data entries
22 entries across 22 versions & 1 rubygems