Sha256: bf96990e7fdd29a0085a09b6e532e9c07594221371b6f3cb47c77ba40d6ce241

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

class Realize < ActiveRecord::Base
  attr_accessible :agent_id, :expression_id, :realize_type_id, :position
  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

1 entries across 1 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre63 app/models/realize.rb