Sha256: a54def67119f76117f4eeabda22aff7205b988e46a937c0d9b9687e03a18bb85

Contents?: true

Size: 829 Bytes

Versions: 12

Compression:

Stored size: 829 Bytes

Contents

class Own < ActiveRecord::Base
  attr_accessible :agent_id, :item_id
  belongs_to :agent #, :counter_cache => true #, :polymorphic => true, :validate => true
  belongs_to :item #, :counter_cache => true #, :validate => true

  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

12 entries across 12 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre55 app/models/own.rb
enju_biblio-0.1.0.pre54 app/models/own.rb
enju_biblio-0.1.0.pre53 app/models/own.rb
enju_biblio-0.1.0.pre52 app/models/own.rb
enju_biblio-0.1.0.pre51 app/models/own.rb
enju_biblio-0.1.0.pre50 app/models/own.rb
enju_biblio-0.1.0.pre49 app/models/own.rb
enju_biblio-0.1.0.pre48 app/models/own.rb
enju_biblio-0.1.0.pre47 app/models/own.rb
enju_biblio-0.1.0.pre46 app/models/own.rb
enju_biblio-0.1.0.pre45 app/models/own.rb
enju_biblio-0.1.0.pre44 app/models/own.rb