Sha256: 104a8e58106380d1d3e9415d0d4ec1d2f8e0ae6177bf06e150aec417332f3807

Contents?: true

Size: 1.01 KB

Versions: 24

Compression:

Stored size: 1.01 KB

Contents

class SeriesHasManifestation < ActiveRecord::Base
  attr_accessible :series_statement_id, :manifestation_id
  belongs_to :series_statement
  belongs_to :manifestation
  accepts_nested_attributes_for :series_statement

  validates_associated :series_statement, :manifestation
  validates_presence_of :series_statement_id
  validates_presence_of :manifestation_id, :on => :update
  validates_uniqueness_of :manifestation_id, :scope => :series_statement_id
  after_save :reindex
  after_destroy :reindex

  acts_as_list :scope => :series_statement_id

  paginates_per 10

  def reindex
    series_statement.reload; series_statement.try(:index)
    manifestation.reload; manifestation.try(:index)
  end
end

# == Schema Information
#
# Table name: series_has_manifestations
#
#  id                  :integer          not null, primary key
#  series_statement_id :integer
#  manifestation_id    :integer
#  position            :integer
#  created_at          :datetime         not null
#  updated_at          :datetime         not null
#

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
enju_biblio-0.1.0.pre34 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre33 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre32 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre31 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre30 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre29 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre28 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre27 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre26 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre25 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre24 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre23 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre22 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre21 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre20 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre19 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre18 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre17 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre16 app/models/series_has_manifestation.rb
enju_biblio-0.1.0.pre15 app/models/series_has_manifestation.rb