diff --git a/app/controllers/cnas_controller.rb b/app/controllers/cnas_controller.rb index 3b9b3e5..6657df8 100644 --- a/app/controllers/cnas_controller.rb +++ b/app/controllers/cnas_controller.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 3b73f51..7da965a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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