Sha256: 7de13383e611ecf5b71ff5cd3f500c168bf01fc39b722ad7b407c0d1054137f8

Contents?: true

Size: 899 Bytes

Versions: 3

Compression:

Stored size: 899 Bytes

Contents

class Realize < ActiveRecord::Base
  attr_accessible :patron_id, :expression_id, :realize_type_id
  belongs_to :patron
  belongs_to :expression, :class_name => 'Manifestation', :foreign_key => 'expression_id'
  belongs_to :realize_type

  validates_associated :patron, :expression
  validates_presence_of :patron, :expression
  validates_uniqueness_of :expression_id, :scope => :patron_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list :scope => :expression

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


# == Schema Information
#
# Table name: realizes
#
#  id              :integer         not null, primary key
#  patron_id       :integer         not null
#  expression_id   :integer         not null
#  position        :integer
#  created_at      :datetime        not null
#  updated_at      :datetime        not null
#  realize_type_id :integer
#

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre3 app/models/realize.rb
enju_biblio-0.1.0.pre2 app/models/realize.rb
enju_biblio-0.1.0.pre app/models/realize.rb