Sha256: 795862c526bba5a7f86a0aae80da5c4d30e45c291c1ff8864afe733b95832913

Contents?: true

Size: 863 Bytes

Versions: 9

Compression:

Stored size: 863 Bytes

Contents

class Own < ActiveRecord::Base
  attr_accessible :patron_id, :item_id
  belongs_to :patron #, :counter_cache => true #, :polymorphic => true, :validate => true
  belongs_to :item #, :counter_cache => true #, :validate => true

  validates_associated :patron, :item
  validates_presence_of :patron, :item
  validates_uniqueness_of :item_id, :scope => :patron_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list :scope => :item

  def self.per_page
    10
  end
  attr_accessor :item_identifier

  def reindex
    patron.try(:index)
    item.try(:index)
  end
end

# == Schema Information
#
# Table name: owns
#
#  id         :integer         not null, primary key
#  patron_id  :integer         not null
#  item_id    :integer         not null
#  position   :integer
#  created_at :datetime        not null
#  updated_at :datetime        not null
#

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enju_biblio-0.0.9 app/models/own.rb
enju_biblio-0.0.8 app/models/own.rb
enju_biblio-0.0.7 app/models/own.rb
enju_biblio-0.0.6 app/models/own.rb
enju_biblio-0.0.5 app/models/own.rb
enju_biblio-0.0.4 app/models/own.rb
enju_biblio-0.0.3 app/models/own.rb
enju_biblio-0.0.2 app/models/own.rb
enju_biblio-0.0.1 app/models/own.rb