diff options
author | rautenberg <rautenberg@in-silico.ch> | 2016-10-05 13:34:53 +0200 |
---|---|---|
committer | rautenberg <rautenberg@in-silico.ch> | 2016-10-05 13:34:53 +0200 |
commit | 93fac481d13068dc0e64086924f1bb6f55b3d34d (patch) | |
tree | 32282b87c619b54f28e88e6f1ee61541878c7cb7 | |
parent | f8def6040e35511fde6456b6d7cff928b71a8156 (diff) |
return complete descriptor json for name search
-rw-r--r-- | lib/compound.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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] |