Sha256: 2f27891aa1b8800b6e3145c0d9673890fc85d1e053711f8c2fa555579eee2f92
Contents?: true
Size: 771 Bytes
Versions: 24
Compression:
Stored size: 771 Bytes
Contents
class AgentRelationship < ActiveRecord::Base 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 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
24 entries across 23 versions & 2 rubygems