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


53
54
55
56
57
58
59
60
61
# File 'lib/wings/setup.rb', line 53

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