Sha256: 05a4651696772f0c3e8197447604356c37976bbb081accc71567304c3ef1d9ee

Contents?: true

Size: 857 Bytes

Versions: 7

Compression:

Stored size: 857 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

7 entries across 7 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre10 app/models/create.rb
enju_biblio-0.1.0.pre9 app/models/create.rb
enju_biblio-0.1.0.pre8 app/models/create.rb
enju_biblio-0.1.0.pre7 app/models/create.rb
enju_biblio-0.1.0.pre6 app/models/create.rb
enju_biblio-0.1.0.pre5 app/models/create.rb
enju_biblio-0.1.0.pre4 app/models/create.rb