diff options
-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] |