Commit 03beb7a

mo khan <mo@mokhan.ca>
2014-07-11 00:58:43
move delete logic to mapping configuration.
1 parent 98a626f
lib/humble/database_table.rb
@@ -32,10 +32,6 @@ module Humble
       end
     end
 
-    def destroy(connection, entity)
-      @primary_key.destroy(connection[@name], entity)
-    end
-
     def column_for(key)
       @columns.find { |x| x.matches?(key) }
     end
lib/humble/mapping_configuration.rb
@@ -17,8 +17,8 @@ module Humble
       end
     end
 
-    def delete_using(connection, entity)
-      @table.destroy(connection, entity)
+    def delete_using(session, entity)
+      primary_key.destroy(session.create_connection[@table.name], entity)
     end
 
     def matches?(item)
lib/humble/session.rb
@@ -26,7 +26,7 @@ module Humble
     end
 
     def delete(entity)
-      mapping_for(entity).delete_using(create_connection, entity)
+      mapping_for(entity).delete_using(self, entity)
     end
 
     def dispose