         Ham.merge data,
           model: name.capitalize()
 
-        relation_params = relationship_fields name, data.model, options.connector, options
+        relation_params = relationship_fields name, data.model, self.api(), options
 
         fn = window[data.model]
-        
+
+        if typeof fn != 'function'
+          console.error 'No model for has_one/belongs_to relation found'
+          continue
+
         if typeof self[name + '_id'] != 'function' && name not in options.belongs_to
           unless options.editable?
             options.editable = []
 
           options.editable.push name + '_id'
-        
+          console.log self[name + 'id']
+
 
         if self[name]?
           Observable self, name, new fn(self[name])

    if params? && params.id?
      connector.read(params.id, params).done callback
    else
      console.log connector
      connector.read(params).done callback

  # Shorthand for model.get, just provide a single ID
  #
  model.get_one = (id, observable) ->
    model.get { id: id }, observable

  # Create new object with given params
  #
  model.create = (params = {}, callbackOrObservable) ->
    callback = (data) ->
      callbackOrObservable.push model(data)
    
    if typeof callbackOrObservable['push'] == 'undefined'
      if typeof callbackOrObservable != 'function'
        console.log 'model.create 2nd parameter needs to be either a function or a pushable object (Array, ObservableArray).\nGiven:'

    # Include sortable functions
    if options.sortable? && options.sortable == true
      Sortable self

    # Include selectable functions
    if options.selectable? && options.selectable == true
      Selectable self

    # Set relations
    # API wise has_one and belongs_to are the same, so we merge them
    #
