//
//  Updatable+Extension.swift
//  FirebaseCommunity
//
//  Created by Victor Alisson on 16/08/17.
//

import Foundation

public extension Updatable where Self: FirebaseModel {
    func update(completion: @escaping (_ error: Error?) -> Void) {
        guard let key = self.key else {
            return
        }
        Self.classPath.child(key).updateChildValues(toJSON()) { (error, reference) in
            completion(error)
        }
    }
}

//
//  Updatable+Extension.swift
//  FirebaseCommunity
//
//  Created by Victor Alisson on 16/08/17.
//

import Foundation

public extension Updatable where Self: FirebaseModel {
    func update(completion: @escaping (_ error: Error?) -> Void) {
        Self.path.updateChildValues(self.toJSON()) { (error, reference) in
            completion(error)
        }
    }
}

--- 
+++ 
@@ -9,7 +9,10 @@
 
 public extension Updatable where Self: FirebaseModel {
     func update(completion: @escaping (_ error: Error?) -> Void) {
-        Self.path.updateChildValues(self.toJSON()) { (error, reference) in
+        guard let key = self.key else {
+            return
+        }
+        Self.classPath.child(key).updateChildValues(toJSON()) { (error, reference) in
             completion(error)
         }
     }
Change how to update the FirebaseModel
