Sha256: e6a02b64229e8d66730bcf76bdac815e8c787fb0308b3612fb68d041e72cc7cd

Contents?: true

Size: 855 Bytes

Versions: 12

Compression:

Stored size: 855 Bytes

Contents

class Create < ActiveRecord::Base
  attr_accessible :agent_id, :work_id, :create_type_id, :position
  belongs_to :agent
  belongs_to :work, :class_name => 'Manifestation', :foreign_key => 'work_id'
  belongs_to :create_type

  validates_associated :agent, :work
  validates_presence_of :agent_id, :work_id
  validates_uniqueness_of :work_id, :scope => :agent_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list :scope => :work

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

# == Schema Information
#
# Table name: creates
#
#  id             :integer          not null, primary key
#  agent_id       :integer          not null
#  work_id        :integer          not null
#  position       :integer
#  created_at     :datetime         not null
#  updated_at     :datetime         not null
#  create_type_id :integer
#

Version data entries

12 entries across 12 versions & 1 rubygems

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