       todos: @todos
 
     onAddTodo: (payload) ->
+      # Update UI
       new_todo = payload.new_todo
       @todos[new_todo.id] = new_todo
       @emit('change')
 
     onToggleTodo: (payload) ->
+      # Update UI
       @todos[payload.id].completed = payload.completed
       @emit('change')
 
     onUpdateTodo: (payload) ->
-      params = todo:
-                 content: payload.new_content
-      $.ajax
-        method: "PATCH"
-        url: "/todos/" + payload.id
-        data: params
-      .done (data, textStatus, jqXHR) =>
-        todo =
-          id:        data.id
-          content:   data.content
-          completed: data.completed
-        @todos[data.id] = todo
-        @emit('change')
-        $.growl.notice title: "", message: "Todo updated"
-      .fail (jqXHR, textStatus, errorThrown) =>
-        $.growl.error title: "Error", message: "Error updating todo"
-        console.error textStatus, errorThrown.toString()
+      # Update UI
+      @todos[payload.id].content = payload.new_content
+      @emit('change')
 
     onDeleteTodo: (payload) ->
       id = payload.id

        $.growl.error title: "Error", message: "Error toggleing todo completion"
        console.error textStatus, errorThrown.toString()

    updateTodo: (id, new_content) ->
      @dispatch(constants.UPDATE_TODO, id: id, new_content: new_content)

    deleteTodo: (id) ->
      @dispatch(constants.DELETE_TODO, id: id)


        $.growl.error title: "Error", message: "Error adding todo"
        console.error textStatus, errorThrown.toString()

    # Saves a new completion status to database. Dispatches TOGGLE_TODO on successful Ajax.
    toggleTodo: (id, completed) ->
      params = todo:
                 completed: completed
