Module: ActiveFedora::Associations::ClassMethods

Defined in:
lib/active_fedora/associations.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to(association_id, options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/active_fedora/associations.rb', line 41

def belongs_to(association_id, options = {})
  raise "You must specify a property name for #{name}" if !options[:property]
  has_relationship association_id.to_s, options[:property]
  reflection = create_belongs_to_reflection(association_id, options)

  association_accessor_methods(reflection, BelongsToAssociation)
    # association_constructor_method(:build,  reflection, BelongsToAssociation)
    # association_constructor_method(:create, reflection, BelongsToAssociation)
  #configure_dependency_for_belongs_to(reflection)
end

#has_many(association_id, options = {}) ⇒ Object



33
34
35
36
37
38
# File 'lib/active_fedora/associations.rb', line 33

def has_many(association_id, options={})
  raise "You must specify a property name for #{name}" if !options[:property]
  has_relationship association_id.to_s, options[:property], :inbound => true
  reflection = create_has_many_reflection(association_id, options)
  collection_accessor_methods(reflection, HasManyAssociation)
end