Sha256: e780fb9eb4096c31cbf82e7b9175f6ecd40abee823dc4cc9008e538c34a7c1b3

Contents?: true

Size: 707 Bytes

Versions: 7

Compression:

Stored size: 707 Bytes

Contents

class Own < ActiveRecord::Base
  attr_accessible :agent_id, :item_id
  belongs_to :agent
  belongs_to :item

  validates_associated :agent, :item
  validates_presence_of :agent, :item
  validates_uniqueness_of :item_id, scope: :agent_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list scope: :item

  attr_accessor :item_identifier

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

# == Schema Information
#
# Table name: owns
#
#  id         :integer          not null, primary key
#  agent_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/own.rb
enju_biblio-0.1.0.pre61 app/models/own.rb
enju_biblio-0.1.0.pre60 app/models/own.rb
enju_biblio-0.1.0.pre59 app/models/own.rb
enju_biblio-0.1.0.pre58 app/models/own.rb
enju_biblio-0.1.0.pre57 app/models/own.rb
enju_biblio-0.1.0.pre56 app/models/own.rb