Sha256: 7f0eb249ac16ae0c168840315b4b8eb43ee7a806969d2b64ce3600d5b1aeeb5c

Contents?: true

Size: 934 Bytes

Versions: 9

Compression:

Stored size: 934 Bytes

Contents

class SubjectHasClassification < ActiveRecord::Base
  belongs_to :subject #, :polymorphic => true, :validate => true
  belongs_to :classification, :validate => true

  validates_associated :subject, :classification
  validates_presence_of :subject, :classification
  validates_uniqueness_of :classification_id, :scope => :subject_id

  def self.per_page
    10
  end

  #def after_save
  #  if self.subject
  #    self.subject.reload
  #    self.subject.save
  #  end
  #  if self.classification
  #    self.classification.reload
  #    self.classification.save
  #  end
  #end

  #def after_destroy
  #  after_save
  #end
end

# == Schema Information
#
# Table name: subject_has_classifications
#
#  id                :integer         not null, primary key
#  subject_id        :integer
#  subject_type      :string(255)
#  classification_id :integer         not null
#  created_at        :datetime
#  updated_at        :datetime
#

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enju_subject-0.0.13 app/models/subject_has_classification.rb
enju_subject-0.0.12 app/models/subject_has_classification.rb
enju_subject-0.0.10 app/models/subject_has_classification.rb
enju_subject-0.0.9 app/models/subject_has_classification.rb
enju_subject-0.0.8 app/models/subject_has_classification.rb
enju_subject-0.0.7 app/models/subject_has_classification.rb
enju_subject-0.0.6 app/models/subject_has_classification.rb
enju_subject-0.0.5 app/models/subject_has_classification.rb
enju_subject-0.0.4 app/models/subject_has_classification.rb