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



85
86
87
88
89
90
91
92
93
# File 'lib/wings/setup.rb', line 85

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