Sha256: eed34775682dffe70cde4d13230379f080fd349a92a0699ce11432286ea92283

Contents?: true

Size: 938 Bytes

Versions: 12

Compression:

Stored size: 938 Bytes

Contents

class Produce < ActiveRecord::Base
  attr_accessible :agent_id, :manifestation_id, :produce_type_id, :position
  belongs_to :agent
  belongs_to :manifestation
  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

12 entries across 12 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre55 app/models/produce.rb
enju_biblio-0.1.0.pre54 app/models/produce.rb
enju_biblio-0.1.0.pre53 app/models/produce.rb
enju_biblio-0.1.0.pre52 app/models/produce.rb
enju_biblio-0.1.0.pre51 app/models/produce.rb
enju_biblio-0.1.0.pre50 app/models/produce.rb
enju_biblio-0.1.0.pre49 app/models/produce.rb
enju_biblio-0.1.0.pre48 app/models/produce.rb
enju_biblio-0.1.0.pre47 app/models/produce.rb
enju_biblio-0.1.0.pre46 app/models/produce.rb
enju_biblio-0.1.0.pre45 app/models/produce.rb
enju_biblio-0.1.0.pre44 app/models/produce.rb