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