Sha256: ca6b20fe5f4f5bf8c5ea9535b87b27998f153afff6198116b9edadcd0a7219ce

Contents?: true

Size: 952 Bytes

Versions: 10

Compression:

Stored size: 952 Bytes

Contents

class SubjectHasClassification < ActiveRecord::Base
  attr_accessible :subject_id, :classification_id
  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 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

10 entries across 10 versions & 2 rubygems

Version Path
enju_trunk_subject-1.0.4 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre12 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre11 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre10 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre9 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre8 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre7 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre6 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre5 app/models/subject_has_classification.rb
enju_subject-0.1.0.pre4 app/models/subject_has_classification.rb