Class: ActiveFedora::Associations::ContainsAssociation

Inherits:
Object
  • Object
show all
Defined in:
lib/wings/setup.rb

Instance Method Summary collapse

Instance Method Details

#build_or_set(attributes, &block) ⇒ Object


68
69
70
71
72
73
74
75
76
# File 'lib/wings/setup.rb', line 68

def build_or_set(attributes, &block)
  if attributes.is_a?(Array)
    attributes.collect { |attr| build_or_set(attr, &block) }
  else
    add_to_target(reflection.build_association(attributes)) do |record|
      yield(record) if block_given?
    end
  end
end