Sha256: aa61831c20526d18ea86fcd8b6f83e71a8b69ddc89b8e9b1dc303a4ee70c7427

Contents?: true

Size: 816 Bytes

Versions: 22

Compression:

Stored size: 816 Bytes

Contents

class Realize < ApplicationRecord
  belongs_to :agent
  belongs_to :expression, class_name: 'Manifestation', foreign_key: 'expression_id', touch: true
  belongs_to :realize_type, optional: true

  validates_associated :agent, :expression
  validates_presence_of :agent, :expression
  validates_uniqueness_of :expression_id, scope: :agent_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list scope: :expression

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

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
enju_biblio-0.3.18 app/models/realize.rb
enju_biblio-0.3.17 app/models/realize.rb
enju_biblio-0.3.16 app/models/realize.rb
enju_biblio-0.3.15 app/models/realize.rb
enju_biblio-0.3.14 app/models/realize.rb
enju_biblio-0.3.13 app/models/realize.rb
enju_biblio-0.3.12 app/models/realize.rb
enju_biblio-0.3.11 app/models/realize.rb
enju_biblio-0.3.10 app/models/realize.rb
enju_biblio-0.3.10.rc.3 app/models/realize.rb
enju_biblio-0.3.10.rc.2 app/models/realize.rb
enju_biblio-0.3.10.rc.1 app/models/realize.rb
enju_biblio-0.3.9 app/models/realize.rb
enju_biblio-0.4.0.rc.1 app/models/realize.rb
enju_biblio-0.3.8 app/models/realize.rb
enju_biblio-0.3.7 app/models/realize.rb
enju_biblio-0.3.6 app/models/realize.rb
enju_biblio-0.4.0.beta.2 app/models/realize.rb
enju_biblio-0.4.0.beta.1 app/models/realize.rb
enju_biblio-0.3.5 app/models/realize.rb