 class App.Base
   constructor: (@opts) ->
+    @opts ||= {}
+
     dash_str = @constructor.name.replace /([A-Z])/g, ($1) ->
       "-" + $1.toLowerCase()
-    @model = dash_str[1 .. dash_str.length - 1]
+    @model_name = dash_str[1 .. dash_str.length - 1]
 
-    # @binder = new App.DataBinder(@id, @model)
+    # @binder = new App.DataBinder(@id, @model_name)
     @attributes = {}
     template = @opts.template || App[@constructor.name].template
 

      $("input[data-k-uuid='" + @uuid + "'][data-attr='" + attr + "']").data("val", val)

  append_data_model: ->
    model_div = "<div data-k-uuid=" + @uuid + " data-id=" + @id + " data-class=" + @model.replace("-", "_") + " data-parent-type=" + @parent + " data-parent-id=" + @parent_id + "></div>"
    $("[data-kindred-model]").append(model_div)

        $("[data-error][data-attr='" + attr + "'][data-k-uuid='" + @uuid + "']").hide()

  save: ->
    @route ||= @model_name.replace("-", "_") + "s"
    if !isNaN(parseFloat(@id)) && isFinite(@id)

      # TODO REMOVE THIS AFTER WEBKIT BUG FIX. https://github.com/thoughtbot/capybara-webkit/issues/553
      # This conditonal is for testing but there is no easy fix at the moment.
      # Put passes through data.  Patch dosn't.
      if (userAgent = window?.navigator?.userAgent).match /capybara-webkit/ || userAgent.match /PhantomJS/
        url = "/" + @route + "/" + @id + ".json"
        method = 'PUT'
      else
        url = "/" + @route + "/" + @id + ".json"
        method = 'PATCH'
    else
      url = "/" + @route + ".json"
      method = "POST"

    params = {}
    params[@model_name.replace("-", "_")] = @attributes

    response = $.ajax(
      type: method
