Sha256: e65ec5f0ce4ccf0f8ab4f5246ce155f896650ee5c9a5e506dc807321000a2c30

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

module EnjuSubject
  module EnjuManifestation
    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      def enju_subject_manifestation_model
        include InstanceMethods
        attr_accessible :subjects_attributes, :classifications_attributes
        has_many :subjects
        has_many :classifications
        accepts_nested_attributes_for :subjects, :allow_destroy => true, :reject_if => :all_blank
        accepts_nested_attributes_for :classifications, :allow_destroy => true, :reject_if => :all_blank

        searchable do
          text :subject do
            subjects.map{|s| [s.term, s.term_transcription]}.flatten.compact
          end
          string :subject, :multiple => true do
            subjects.map{|s| [s.term, s.term_transcription]}.flatten.compact
          end
          string :classification, :multiple => true do
            classifications.collect(&:category)
          end
          integer :subject_ids, :multiple => true
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
enju_subject-0.1.0.pre26 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre25 lib/enju_subject/manifestation.rb
enju_trunk_subject-1.0.4 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre24 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre23 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre22 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre21 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre20 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre19 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre18 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre17 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre16 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre15 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre14 lib/enju_subject/manifestation.rb
enju_subject-0.1.0.pre13 lib/enju_subject/manifestation.rb