Sha256: 229c1ad2a236f7ccd0287f55b70d75c355b0535fe9868d8317d5837314938115

Contents?: true

Size: 963 Bytes

Versions: 9

Compression:

Stored size: 963 Bytes

Contents

class Produce < ActiveRecord::Base
  attr_accessible :patron_id, :manifestation_id, :produce_type_id
  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 self.per_page
    10
  end

  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

9 entries across 9 versions & 1 rubygems

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