Sha256: e3a7d9f775be4708276b552f434fd10fa5003ccf2091f06f73582a9dbb48ed46

Contents?: true

Size: 940 Bytes

Versions: 7

Compression:

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

7 entries across 7 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre10 app/models/produce.rb
enju_biblio-0.1.0.pre9 app/models/produce.rb
enju_biblio-0.1.0.pre8 app/models/produce.rb
enju_biblio-0.1.0.pre7 app/models/produce.rb
enju_biblio-0.1.0.pre6 app/models/produce.rb
enju_biblio-0.1.0.pre5 app/models/produce.rb
enju_biblio-0.1.0.pre4 app/models/produce.rb