Sha256: edfbdc1cc1f540f41f9ddb53954180a17d9aa931e6e9356d52a093fed0816fae

Contents?: true

Size: 778 Bytes

Versions: 3

Compression:

Stored size: 778 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
#  updated_at       :datetime
#

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre66 app/models/exemplify.rb
enju_biblio-0.1.0.pre65 app/models/exemplify.rb
enju_biblio-0.1.0.pre64 app/models/exemplify.rb