Sha256: ce4936c3ccccbbe4789f8a4652718bfabb0ab4e53eb40b954f0d3102bf2c6f1b

Contents?: true

Size: 812 Bytes

Versions: 7

Compression:

Stored size: 812 Bytes

Contents

class Exemplify < ActiveRecord::Base
  attr_accessible :manifestation_id, :item_id, :position
  belongs_to :manifestation
  belongs_to :item
  #accepts_nested_attributes_for :item

  validates_associated :manifestation, :item
  validates_presence_of :manifestation_id, :item_id
  validates_uniqueness_of :item_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list scope: :manifestation_id

  def reindex
    manifestation.try(:index)
    item.try(:index)
  end
end

# == Schema Information
#
# Table name: exemplifies
#
#  id               :integer          not null, primary key
#  manifestation_id :integer          not null
#  item_id          :integer          not null
#  position         :integer
#  created_at       :datetime         not null
#  updated_at       :datetime         not null
#

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre62 app/models/exemplify.rb
enju_biblio-0.1.0.pre61 app/models/exemplify.rb
enju_biblio-0.1.0.pre60 app/models/exemplify.rb
enju_biblio-0.1.0.pre59 app/models/exemplify.rb
enju_biblio-0.1.0.pre58 app/models/exemplify.rb
enju_biblio-0.1.0.pre57 app/models/exemplify.rb
enju_biblio-0.1.0.pre56 app/models/exemplify.rb