Sha256: f7eb8013024ae4229b34481e38ce1b2bed32f3b51b3a8ec715f35f72000c297c
Contents?: true
Size: 903 Bytes
Versions: 32
Compression:
Stored size: 903 Bytes
Contents
class PatronRelationship < ActiveRecord::Base attr_accessible :parent_id, :child_id, :patron_relationship_type_id belongs_to :parent, :foreign_key => 'parent_id', :class_name => 'Patron' belongs_to :child, :foreign_key => 'child_id', :class_name => 'Patron' belongs_to :patron_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: patron_relationships # # id :integer not null, primary key # parent_id :integer # child_id :integer # patron_relationship_type_id :integer # created_at :datetime not null # updated_at :datetime not null # position :integer #
Version data entries
32 entries across 32 versions & 1 rubygems