Sha256: 434ac485dbb644c675769c23053f6e1d37bb9d4eb89cf28f2f7a25ae86467fb4

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

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

Version data entries

1 entries across 1 versions & 1 rubygems

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