Sha256: 9561aefc573c85787193495b2b34f800c84c0582e7f528b16b9dd8b231ad0b62

Contents?: true

Size: 945 Bytes

Versions: 4

Compression:

Stored size: 945 Bytes

Contents

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

  validates_associated :agent, :manifestation
  validates_presence_of :agent, :manifestation
  validates_uniqueness_of :manifestation_id, scope: :agent_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list scope: :manifestation

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

# == Schema Information
#
# Table name: produces
#
#  id               :integer          not null, primary key
#  agent_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

4 entries across 4 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre59 app/models/produce.rb
enju_biblio-0.1.0.pre58 app/models/produce.rb
enju_biblio-0.1.0.pre57 app/models/produce.rb
enju_biblio-0.1.0.pre56 app/models/produce.rb