Class: Ripple::Associations::ManyEmbeddedProxy

Inherits:
Proxy show all
Includes:
Embedded, Many
Defined in:
ripple/lib/ripple/associations/many_embedded_proxy.rb

Instance Attribute Summary

Attributes inherited from Proxy

owner, reflection, target

Instance Method Summary (collapse)

Methods included from Embedded

#initialize

Methods included from Many

#count, #reset, #to_ary

Methods included from Instantiators

#build, #create, #create!

Methods inherited from Proxy

#===, #blank?, #initialize, #inspect, #loaded, #loaded?, #nil?, #present?, #proxy_respond_to?, #reload, #reset, #respond_to?, #send

Constructor Details

This class inherits a constructor from Ripple::Associations::Embedded

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ripple::Associations::Proxy

Instance Method Details

- (Object) <<(docs)



25
26
27
28
29
30
31
# File 'ripple/lib/ripple/associations/many_embedded_proxy.rb', line 25

def <<(docs)
  load_target
  @reflection.verify_type!(Array(docs), @owner)
  assign_references(docs)
  @target += Array(docs)
  self
end

- (Object) replace(docs)



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

def replace(docs)
  @reflection.verify_type!(docs, @owner)
  @_docs = docs.map { |doc| attrs = doc.respond_to?(:attributes_for_persistence) ? doc.attributes_for_persistence : doc }
  assign_references(docs)
  reset
  @_docs
end