lib/enrichment_db/datum.rb in enrichment_db-0.1.5 vs lib/enrichment_db/datum.rb in enrichment_db-0.1.6
- old
+ new
@@ -3,18 +3,12 @@
class EnrichmentDb::Datum < EnrichmentDb::DatumModel
def self.by_id(schema_name, table_name, condition)
puts "Finding object from #{table_name} with condition #{condition}."
query = "SELECT * FROM #{schema_name}.#{table_name} where #{condition}"
- result = EnrichmentDb.request(schema_name, query)
-
- if result.ntuples > 0
- puts "Found #{result.ntuples} object/s"
- result.collect do |v|
- v
- end
- else
- puts "Nothing found"
- nil
+ result = EnrichmentDb.request(schema_name, query).collect do |record|
+ record
end
+
+ format_result(result)
end
end