     params = {}
     params[@model.replace("-", "_")] = @attributes
 
-    JSON.parse $.ajax(
+    response = $.ajax(
       type: method
       url: url
       dataType: "json"

        input = $template.find("input[data-attr='" + key + "']")
        input.val(value)

    $("[data-append='" + @model + "']").append($template)

  assign_attributes_from_page: ->
    $("input[data-adq-uuid='" + @uuid + "']").each (i, input) =>
      $input = $(input)
      @set $input.data("attr"), $input.val()
      if $input.data("id")?
        @id = $input.data("id")
    @



      global: false
      async: false
      success: (data, textStatus, xhr) ->
        xhr.status
      error: (data, textStatus, xhr) =>
        @error = data.status
    ).responseText

    obj = JSON.parse(response)

    @handle_errors(obj)

  destroy: ->
    @route ||= @model.replace("-", "_") + "s"
    url = "/" + @route + "/" + @id + ".json"
    method = "DELETE"

    if !isNaN(parseFloat(@id)) && isFinite(@id)
      $.ajax
        type: method
        url: url
        dataType: "json"
        global: false
        async: false

  set_attributes: (attrs) ->
    $.each attrs, (attr, val) =>
