         else
           self["_#{attr}"] = null
 
+    for klass in @has_many()
+      do(klass) ->
+        self["_#{klass}"] = []
+        self.attributes.push("#{klass}")
+        self["add_#{klass}"] = (z) ->
+          name = z.constructor.name
+          me = self.normal_name()
+          expected = klass.charAt(0).toUpperCase() + klass.slice(1)
+          throw "Expected #{expected}, but given: #{name}" if name isnt expected
+          #feedback
+          if z.attributes.indexOf(me) > -1
+            if z.has_one().indexOf(me) > -1
+              m = z.get("#{me}")
+              z.set("#{me}", self) if !m
+            else if z.has_many().indexOf(me) > -1
+              z.get("#{me}").push(self)
+
+
+          self.get("#{klass}").push(z)
+
+    for klass in @has_one()
+      do(klass) ->
+        self["_#{klass}"] = null
+        self.attributes.push("#{klass}")
+        self["add_#{klass}"] = (z) ->
+          name = z.constructor.name
+          me = self.normal_name()
+          expected = klass.charAt(0).toUpperCase() + klass.slice(1)
+          throw "Expected #{expected}, but given: #{name}" if name isnt expected
+
+          t = self.get("#{klass}")
+          throw "Model #{klass} exist" if t
+
+          if z.attributes.indexOf(me) > -1
+            if z.has_one().indexOf(me) > -1
+              m = z.get("#{me}")
+              z.set("#{me}", self) if !m
+            else if z.has_many().indexOf(me) > -1
+              z.get("#{me}").push(self)
+
+          self.set("#{klass}", z)
+
+
     if Object.keys(obj).length != 0
       for attr in Object.keys(obj)
         do(attr) ->



  set: (attr, value) ->
    throw new Error("Attribute '#{attr}' not found for current model") if @attributes.indexOf(attr) == -1

    # TODO validate value
    @["_#{attr}"] = value

  get: (attr) ->
    throw new Error("Attribute '#{attr}' not found for current model") if @attributes.indexOf(attr) == -1

    @["_#{attr}"]


    @_isValid = false
    @errors = {}
    @attributes = @normalize_attrs()

    for attr in @attrs()
      do(attr) ->
