Sha256: fa195cc4a90d92ff1422eaff5f5c07b01a119e81fa1257c2648988720b56506a

Contents?: true

Size: 868 Bytes

Versions: 19

Compression:

Stored size: 868 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
#  updated_at                  :datetime
#  position                    :integer
#

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre10 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre9 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre8 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre7 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre6 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre5 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre4 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre3 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre2 app/models/patron_relationship.rb
enju_biblio-0.1.0.pre app/models/patron_relationship.rb
enju_biblio-0.0.9 app/models/patron_relationship.rb
enju_biblio-0.0.8 app/models/patron_relationship.rb
enju_biblio-0.0.7 app/models/patron_relationship.rb
enju_biblio-0.0.6 app/models/patron_relationship.rb
enju_biblio-0.0.5 app/models/patron_relationship.rb
enju_biblio-0.0.4 app/models/patron_relationship.rb
enju_biblio-0.0.3 app/models/patron_relationship.rb
enju_biblio-0.0.2 app/models/patron_relationship.rb
enju_biblio-0.0.1 app/models/patron_relationship.rb