Sha256: 39126cc319f97b2a001f97469b401ee010d6c2ff7b09689f51d1f13cef4696e9

Contents?: true

Size: 944 Bytes

Versions: 32

Compression:

Stored size: 944 Bytes

Contents

class Produce < ActiveRecord::Base
  attr_accessible :patron_id, :manifestation_id, :produce_type_id, :position
  belongs_to :patron
  belongs_to :manifestation
  belongs_to :produce_type
  delegate :original_title, :to => :manifestation, :prefix => true

  validates_associated :patron, :manifestation
  validates_presence_of :patron, :manifestation
  validates_uniqueness_of :manifestation_id, :scope => :patron_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list :scope => :manifestation

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

# == Schema Information
#
# Table name: produces
#
#  id               :integer          not null, primary key
#  patron_id        :integer          not null
#  manifestation_id :integer          not null
#  position         :integer
#  created_at       :datetime         not null
#  updated_at       :datetime         not null
#  produce_type_id  :integer
#

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre42 app/models/produce.rb
enju_biblio-0.1.0.pre41 app/models/produce.rb
enju_biblio-0.1.0.pre40 app/models/produce.rb
enju_biblio-0.1.0.pre39 app/models/produce.rb
enju_biblio-0.1.0.pre38 app/models/produce.rb
enju_biblio-0.1.0.pre37 app/models/produce.rb
enju_biblio-0.1.0.pre36 app/models/produce.rb
enju_biblio-0.1.0.pre35 app/models/produce.rb
enju_biblio-0.1.0.pre34 app/models/produce.rb
enju_biblio-0.1.0.pre33 app/models/produce.rb
enju_biblio-0.1.0.pre32 app/models/produce.rb
enju_biblio-0.1.0.pre31 app/models/produce.rb
enju_biblio-0.1.0.pre30 app/models/produce.rb
enju_biblio-0.1.0.pre29 app/models/produce.rb
enju_biblio-0.1.0.pre28 app/models/produce.rb
enju_biblio-0.1.0.pre27 app/models/produce.rb
enju_biblio-0.1.0.pre26 app/models/produce.rb
enju_biblio-0.1.0.pre25 app/models/produce.rb
enju_biblio-0.1.0.pre24 app/models/produce.rb
enju_biblio-0.1.0.pre23 app/models/produce.rb