Sha256: e636d6794c8d6aa41e272b434f454f9446ca2afa698299d5aaf83ee3683156e0

Contents?: true

Size: 861 Bytes

Versions: 32

Compression:

Stored size: 861 Bytes

Contents

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

  validates_associated :patron, :work
  validates_presence_of :patron_id, :work_id
  validates_uniqueness_of :work_id, :scope => :patron_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list :scope => :work

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

# == Schema Information
#
# Table name: creates
#
#  id             :integer          not null, primary key
#  patron_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

32 entries across 32 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre42 app/models/create.rb
enju_biblio-0.1.0.pre41 app/models/create.rb
enju_biblio-0.1.0.pre40 app/models/create.rb
enju_biblio-0.1.0.pre39 app/models/create.rb
enju_biblio-0.1.0.pre38 app/models/create.rb
enju_biblio-0.1.0.pre37 app/models/create.rb
enju_biblio-0.1.0.pre36 app/models/create.rb
enju_biblio-0.1.0.pre35 app/models/create.rb
enju_biblio-0.1.0.pre34 app/models/create.rb
enju_biblio-0.1.0.pre33 app/models/create.rb
enju_biblio-0.1.0.pre32 app/models/create.rb
enju_biblio-0.1.0.pre31 app/models/create.rb
enju_biblio-0.1.0.pre30 app/models/create.rb
enju_biblio-0.1.0.pre29 app/models/create.rb
enju_biblio-0.1.0.pre28 app/models/create.rb
enju_biblio-0.1.0.pre27 app/models/create.rb
enju_biblio-0.1.0.pre26 app/models/create.rb
enju_biblio-0.1.0.pre25 app/models/create.rb
enju_biblio-0.1.0.pre24 app/models/create.rb
enju_biblio-0.1.0.pre23 app/models/create.rb