Sha256: 558cff584fddc119f443cebab27d78de843e35eec703a7815f319d65d27fe1e6

Contents?: true

Size: 844 Bytes

Versions: 5

Compression:

Stored size: 844 Bytes

Contents

class Produce < ActiveRecord::Base
  belongs_to :agent
  belongs_to :manifestation, touch: true
  belongs_to :produce_type, optional: true
  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
#  updated_at       :datetime
#  produce_type_id  :integer
#

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enju_biblio-0.3.2 app/models/produce.rb
enju_biblio-0.3.1 app/models/produce.rb
enju_biblio-0.3.0 app/models/produce.rb
enju_biblio-0.3.0.rc.1 app/models/produce.rb
enju_biblio-0.3.0.beta.2 app/models/produce.rb