add a route to search via orgname

This commit is contained in:
Brendan McDevitt 2022-04-07 18:26:42 -05:00
parent 7ca243b324
commit 4881609ee7
2 changed files with 6 additions and 0 deletions

View file

@ -12,4 +12,9 @@ class CnasController < ApplicationController
@cna = Cna.find_by_cna_id(params[:cna_id])
render json: @cna.to_json
end
def show_for_orgname
@cna = Cna.find_by(:organization_name => params[:organization_name])
render json: @cna.to_json
end
end

View file

@ -28,5 +28,6 @@ Rails.application.routes.draw do
get "/cnas", to: "cnas#index"
get "/cnas/:id", to: "cnas#show"
get "/cnas/cna/:cna_id", to: "cnas#show_for_cna"
get "/cnas/organization_name/:organization_name", to: "cnas#show_for_orgname"
end