Class: ActiveFedora::Associations::Builder::Property

Inherits:
Association
  • Object
show all
Defined in:
lib/active_fedora/associations/builder/property.rb

Direct Known Subclasses

SingularProperty

Instance Attribute Summary

Attributes inherited from Association

#inversed, #owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from Association

#association_scope, #initialize_attributes, #load_target, #loaded!, #loaded?, #reload, #reset, #scope, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

#initialize(model, name, options) ⇒ Property

Returns a new instance of Property.



7
8
9
10
# File 'lib/active_fedora/associations/builder/property.rb', line 7

def initialize(model, name, options)
  super
  @name = :"#{name.to_s.singularize}_ids"
end

Instance Method Details

#buildObject



12
13
14
15
16
# File 'lib/active_fedora/associations/builder/property.rb', line 12

def build
  super.tap do |reflection|
    model.index_config[name] = build_index_config(reflection)
  end
end

#build_index_config(reflection) ⇒ Object



18
19
20
# File 'lib/active_fedora/associations/builder/property.rb', line 18

def build_index_config(reflection)
  ActiveFedora::Indexing::Map::IndexObject.new(reflection.predicate_for_solr) { |index| index.as :symbol }
end