Module: RPCMapper::Associations::Contains::ClassMethods

Defined in:
lib/rpc_mapper/associations/contains.rb

Instance Method Summary collapse

Instance Method Details

#contains_many(association, options = {}) ⇒ Object

TRP: Define an association that is serialized within the data for this class. If a subset of the data returned for a class contains the data for another class you can use the contains_many association to (lazy) auto initialize the specified object(s) using the data from that attribute.



11
12
13
# File 'lib/rpc_mapper/associations/contains.rb', line 11

def contains_many(association, options={})
  create_contains_association(:many, association, options)
end

#contains_one(association, options = {}) ⇒ Object

TRP: Same as contains_many, but only works with a single record



16
17
18
# File 'lib/rpc_mapper/associations/contains.rb', line 16

def contains_one(association, options={})
  create_contains_association(:one, association, options)
end