Sha256: 3a7143bafcba29013ce117c037366139e7f2edbb919db72a88c9ce6440854d41

Contents?: true

Size: 880 Bytes

Versions: 9

Compression:

Stored size: 880 Bytes

Contents

class Create < ActiveRecord::Base
  attr_accessible :patron_id, :work_id, :create_type_id
  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 self.per_page
    10
  end

  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

9 entries across 9 versions & 1 rubygems

Version Path
enju_biblio-0.0.9 app/models/create.rb
enju_biblio-0.0.8 app/models/create.rb
enju_biblio-0.0.7 app/models/create.rb
enju_biblio-0.0.6 app/models/create.rb
enju_biblio-0.0.5 app/models/create.rb
enju_biblio-0.0.4 app/models/create.rb
enju_biblio-0.0.3 app/models/create.rb
enju_biblio-0.0.2 app/models/create.rb
enju_biblio-0.0.1 app/models/create.rb