From 93fac481d13068dc0e64086924f1bb6f55b3d34d Mon Sep 17 00:00:00 2001 From: rautenberg Date: Wed, 5 Oct 2016 13:34:53 +0200 Subject: return complete descriptor json for name search --- lib/compound.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compound.rb b/lib/compound.rb index 99e6c7e..9390a96 100644 --- a/lib/compound.rb +++ b/lib/compound.rb @@ -6,7 +6,7 @@ get "/compound/descriptor/?:descriptor?" do case @accept when "application/json" return "#{JSON.pretty_generate PhysChem::DESCRIPTORS} " unless params[:descriptor] - return {params[:descriptor] => PhysChem::DESCRIPTORS[params[:descriptor]]}.to_json if PhysChem::DESCRIPTORS.include?(params[:descriptor]) + return PhysChem.find_by(:name => params[:descriptor]).to_json if PhysChem::DESCRIPTORS.include?(params[:descriptor]) return PhysChem.find(params[:descriptor]).to_json if PhysChem.find(params[:descriptor]) else return PhysChem::DESCRIPTORS.collect{|k, v| "#{k}: #{v}\n"} unless params[:descriptor] -- cgit v1.2.3