Sha256: b7f8bc9bc85a04bfc99e8249f6c59a316a4b117b459a144265becd1277342b6d

Contents?: true

Size: 801 Bytes

Versions: 24

Compression:

Stored size: 801 Bytes

Contents

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

  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

24 entries across 23 versions & 2 rubygems

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