Sha256: fd14ea74f66eac864f7af4d36a12a88c05886c0e613299a599ec7524125de458

Contents?: true

Size: 830 Bytes

Versions: 10

Compression:

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

10 entries across 10 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre10 app/models/own.rb
enju_biblio-0.1.0.pre9 app/models/own.rb
enju_biblio-0.1.0.pre8 app/models/own.rb
enju_biblio-0.1.0.pre7 app/models/own.rb
enju_biblio-0.1.0.pre6 app/models/own.rb
enju_biblio-0.1.0.pre5 app/models/own.rb
enju_biblio-0.1.0.pre4 app/models/own.rb
enju_biblio-0.1.0.pre3 app/models/own.rb
enju_biblio-0.1.0.pre2 app/models/own.rb
enju_biblio-0.1.0.pre app/models/own.rb