Module: Ripple::Associations::Linked

Included in:
ManyLinkedProxy, OneLinkedProxy
Defined in:
ripple/lib/ripple/associations/linked.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) replace(value)



20
21
22
23
24
25
26
27
28
29
# File 'ripple/lib/ripple/associations/linked.rb', line 20

def replace(value)
  @reflection.verify_type!(value, @owner)
  @owner.robject.links -= links
  Array(value).compact.each do |doc|
    doc.save if doc.new?
    @owner.robject.links << doc.robject.to_link(@reflection.link_tag)
  end
  loaded
  @target = value
end