lib/thingfish/metastore/pggraph.rb
changeset 3 5b4ee98d698c
parent 1 60b437614edd
child 7 f0ef12e25a2f
--- a/lib/thingfish/metastore/pggraph.rb	Thu Nov 05 10:40:01 2015 -0800
+++ b/lib/thingfish/metastore/pggraph.rb	Mon Dec 14 15:42:13 2015 -0800
@@ -24,7 +24,7 @@
 
 
 	# Package version
-	VERSION = '0.1.0'
+	VERSION = '0.1.1'
 
 	# Version control revision
 	REVISION = %q$Revision$
@@ -175,7 +175,8 @@
 	### specified +oid+.
 	def fetch_value( oid, key )
 		metadata = self.model[ oid ] or return nil
-		return metadata.send( key )
+		key = key.to_sym
+		return metadata[ key ] || metadata.user_metadata[ key ]
 	end
 
 
@@ -200,6 +201,8 @@
 		ds = self.apply_search_direction( ds, options )
 		ds = self.apply_search_limit( ds, options )
 
+		self.log.debug "Dataset for search is: %s" % [ ds.sql ]
+
 		return ds.map {|row| row[:id] }
 	end
 
@@ -276,7 +279,8 @@
 	def apply_search_order( ds, options )
 		if options[:order]
 			columns = Array( options[:order] )
-			ds = ds.order( columns.map(&:to_sym) )
+			self.log.debug "  ordering results by columns: %p" % [ columns ]
+			ds = ds.order_metadata( columns )
 		end
 
 		return ds