Sha256: 30426dab8a9a65fd5e7248c4aa7acc2ee8800990c0d63874b3ce4f3baf4d1ae2
Contents?: true
Size: 692 Bytes
Versions: 49
Compression:
Stored size: 692 Bytes
Contents
module Fog module Associations # = Fog Multiple Association # # This class handles multiple association between the models. # It expects the provider to map the attribute with a collection of objects. class ManyModels < Default def create_setter model.class_eval <<-EOS, __FILE__, __LINE__ def #{name}=(new_#{name}) associations[:#{name}] = Array(new_#{name}) end EOS end def create_getter model.class_eval <<-EOS, __FILE__, __LINE__ def #{name} data = associations[:#{name}] #{association_class}.new(data) end EOS end end end end
Version data entries
49 entries across 46 versions & 3 rubygems