Sha256: 6cc099ab46573950dabf390f84a5d63ea4e481d434b7cb69b143a834d8e6400a
Contents?: true
Size: 787 Bytes
Versions: 5
Compression:
Stored size: 787 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, 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
5 entries across 5 versions & 1 rubygems