Sha256: 33da48509f5e90233ab40e58a79b477ec89b7b4321856ae9028707fae36400d2

Contents?: true

Size: 828 Bytes

Versions: 24

Compression:

Stored size: 828 Bytes

Contents

class Produce < ActiveRecord::Base
  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
#  updated_at       :datetime
#  produce_type_id  :integer
#

Version data entries

24 entries across 23 versions & 2 rubygems

Version Path
enju_biblio-0.2.5 app/models/produce.rb
enju_biblio-0.2.4 app/models/produce.rb
enju_biblio-0.2.3 app/models/produce.rb
enju_biblio-0.2.2 app/models/produce.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.1/app/models/produce.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.0/app/models/produce.rb
enju_biblio-0.2.1 app/models/produce.rb
enju_biblio-0.2.0 app/models/produce.rb
enju_biblio-0.2.0.beta.4 app/models/produce.rb
enju_biblio-0.2.0.beta.3 app/models/produce.rb
enju_biblio-0.2.0.beta.2 app/models/produce.rb
enju_biblio-0.2.0.beta.1 app/models/produce.rb
enju_biblio-0.1.3 app/models/produce.rb
enju_biblio-0.1.2 app/models/produce.rb
enju_biblio-0.1.1 app/models/produce.rb
enju_biblio-0.1.0 app/models/produce.rb
enju_biblio-0.1.0.pre71 app/models/produce.rb
enju_biblio-0.1.0.pre70 app/models/produce.rb
enju_biblio-0.1.0.pre69 app/models/produce.rb
enju_biblio-0.1.0.pre68 app/models/produce.rb