Sha256: cb862b7d1fc0c9c79dbe2d9800912b1ba00bb8d7b13cd256f0f418dfd97e1d4c

Contents?: true

Size: 634 Bytes

Versions: 29

Compression:

Stored size: 634 Bytes

Contents

class Own < ActiveRecord::Base
  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

29 entries across 28 versions & 2 rubygems

Version Path
enju_biblio-0.3.2 app/models/own.rb
enju_biblio-0.3.1 app/models/own.rb
enju_biblio-0.3.0 app/models/own.rb
enju_biblio-0.3.0.rc.1 app/models/own.rb
enju_biblio-0.3.0.beta.2 app/models/own.rb
enju_biblio-0.2.5 app/models/own.rb
enju_biblio-0.2.4 app/models/own.rb
enju_biblio-0.2.3 app/models/own.rb
enju_biblio-0.2.2 app/models/own.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.0/app/models/own.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.1/app/models/own.rb
enju_biblio-0.2.1 app/models/own.rb
enju_biblio-0.2.0 app/models/own.rb
enju_biblio-0.2.0.beta.4 app/models/own.rb
enju_biblio-0.2.0.beta.3 app/models/own.rb
enju_biblio-0.2.0.beta.2 app/models/own.rb
enju_biblio-0.2.0.beta.1 app/models/own.rb
enju_biblio-0.1.3 app/models/own.rb
enju_biblio-0.1.2 app/models/own.rb
enju_biblio-0.1.1 app/models/own.rb