Sha256: 8d5677869576fefe737e04580783017b3cca674435907f854e7463a118db1945

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre63 app/models/exemplify.rb