Sha256: 8e18f72e1d16f99c979e31ab524ed1b24a14271ebabb0a4333bfdf8b7f528a2c

Contents?: true

Size: 835 Bytes

Versions: 32

Compression:

Stored size: 835 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

  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

32 entries across 32 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre22 app/models/own.rb
enju_biblio-0.1.0.pre21 app/models/own.rb
enju_biblio-0.1.0.pre20 app/models/own.rb
enju_biblio-0.1.0.pre19 app/models/own.rb
enju_biblio-0.1.0.pre18 app/models/own.rb
enju_biblio-0.1.0.pre17 app/models/own.rb
enju_biblio-0.1.0.pre16 app/models/own.rb
enju_biblio-0.1.0.pre15 app/models/own.rb
enju_biblio-0.1.0.pre14 app/models/own.rb
enju_biblio-0.1.0.pre13 app/models/own.rb
enju_biblio-0.1.0.pre12 app/models/own.rb
enju_biblio-0.1.0.pre11 app/models/own.rb