Sha256: ee33e842d5cd68fb8597827a28d85f55c835478a56f94d1b8463fe5b4c47fece

Contents?: true

Size: 770 Bytes

Versions: 22

Compression:

Stored size: 770 Bytes

Contents

class Create < ApplicationRecord
  belongs_to :agent
  belongs_to :work, class_name: 'Manifestation', foreign_key: 'work_id', touch: true
  belongs_to :create_type, optional: true

  validates_associated :agent, :work
  validates_presence_of :agent_id, :work_id
  validates_uniqueness_of :work_id, scope: :agent_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list scope: :work

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

# == Schema Information
#
# Table name: creates
#
#  id             :integer          not null, primary key
#  agent_id       :integer          not null
#  work_id        :integer          not null
#  position       :integer
#  created_at     :datetime
#  updated_at     :datetime
#  create_type_id :integer
#

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
enju_biblio-0.3.18 app/models/create.rb
enju_biblio-0.3.17 app/models/create.rb
enju_biblio-0.3.16 app/models/create.rb
enju_biblio-0.3.15 app/models/create.rb
enju_biblio-0.3.14 app/models/create.rb
enju_biblio-0.3.13 app/models/create.rb
enju_biblio-0.3.12 app/models/create.rb
enju_biblio-0.3.11 app/models/create.rb
enju_biblio-0.3.10 app/models/create.rb
enju_biblio-0.3.10.rc.3 app/models/create.rb
enju_biblio-0.3.10.rc.2 app/models/create.rb
enju_biblio-0.3.10.rc.1 app/models/create.rb
enju_biblio-0.3.9 app/models/create.rb
enju_biblio-0.4.0.rc.1 app/models/create.rb
enju_biblio-0.3.8 app/models/create.rb
enju_biblio-0.3.7 app/models/create.rb
enju_biblio-0.3.6 app/models/create.rb
enju_biblio-0.4.0.beta.2 app/models/create.rb
enju_biblio-0.4.0.beta.1 app/models/create.rb
enju_biblio-0.3.5 app/models/create.rb