From 7f8dbc606e18109758fa48edafa30346ca5fca30 Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Tue, 5 Apr 2022 12:33:51 -0500 Subject: [PATCH] experimenting with adding a route to show cves for specific year --- app/controllers/cves_controller.rb | 2 +- app/views/cves/show_years.html.erb | 2 ++ config/routes.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 app/views/cves/show_years.html.erb diff --git a/app/controllers/cves_controller.rb b/app/controllers/cves_controller.rb index 70d2e1e..ef256fa 100644 --- a/app/controllers/cves_controller.rb +++ b/app/controllers/cves_controller.rb @@ -9,6 +9,6 @@ class CvesController < ApplicationController end def show_year - @cves_for_year = Cve.for_year(params[:year]) + @cves_for_year = Cve.from_year(params[:year]) end end diff --git a/app/views/cves/show_years.html.erb b/app/views/cves/show_years.html.erb new file mode 100644 index 0000000..fc01c3d --- /dev/null +++ b/app/views/cves/show_years.html.erb @@ -0,0 +1,2 @@ +

params[:year]

+

<%= @cves_for_year %>

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index cfefbc3..4abadb2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html get "/cves", to: "cves#index" get "/cves/:cve_id", to: "cves#show" - get "/cves/:year", to: "cves#show_year" + get "/cves/years/:year", to: "cves#show_year" get "/cpes", to: "cpes#index" get "/cpes/:id", to: "cpes#show"