Sha256: edbf8d6146e6ff571f766363c31858d1b98fe6523e6a373227b29185add43dc4

Contents?: true

Size: 1.57 KB

Versions: 9

Compression:

Stored size: 1.57 KB

Contents

class Subject < ActiveRecord::Base
  attr_accessible :parent_id, :use_term_id, :term, :term_transcription,
    :subject_type_id, :note, :required_role_id

  has_many :work_has_subjects, :dependent => :destroy
  has_many :works, :through => :work_has_subjects, :class_name => 'Manifestation'
  belongs_to :subject_type
  has_many :subject_has_classifications, :dependent => :destroy
  has_many :classifications, :through => :subject_has_classifications
  belongs_to :subject_type, :validate => true
  has_many :subject_heading_type_has_subjects
  has_many :subject_heading_types, :through => :subject_heading_type_has_subjects
  belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'

  validates_associated :subject_type
  validates_presence_of :term, :subject_type

  attr_accessor :classification_id, :subject_heading_type_id

  searchable do
    text :term
    time :created_at
    integer :required_role_id
    integer :work_ids, :multiple => true
  end

  normalize_attributes :term

  paginates_per 10
end

# == Schema Information
#
# Table name: subjects
#
#  id                 :integer          not null, primary key
#  parent_id          :integer
#  use_term_id        :integer
#  term               :string(255)
#  term_transcription :text
#  subject_type_id    :integer          not null
#  scope_note         :text
#  note               :text
#  required_role_id   :integer          default(1), not null
#  lock_version       :integer          default(0), not null
#  created_at         :datetime
#  updated_at         :datetime
#  deleted_at         :datetime
#

Version data entries

9 entries across 9 versions & 1 rubygems

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