From b232d61ecdab6c603eb4a071bf06c93b43080d1e Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Fri, 5 Apr 2024 23:25:48 -0700 Subject: [PATCH] Add ETag/Conditional Get --- app/controllers/flights_controller.rb | 2 +- app/controllers/pilot/flights_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/flights_controller.rb b/app/controllers/flights_controller.rb index 4887e95..d999de5 100644 --- a/app/controllers/flights_controller.rb +++ b/app/controllers/flights_controller.rb @@ -22,7 +22,7 @@ class FlightsController < ApplicationController # |:-----|:----------------------| # | `id` | The UUID of a Flight. | - def show = respond_with @flight + def show = respond_with(@flight) if stale?(@flight) private diff --git a/app/controllers/pilot/flights_controller.rb b/app/controllers/pilot/flights_controller.rb index 63389de..dfcbb11 100644 --- a/app/controllers/pilot/flights_controller.rb +++ b/app/controllers/pilot/flights_controller.rb @@ -17,7 +17,7 @@ class Pilot::FlightsController < ApplicationController def index @flights = current_pilot.flights.with_passenger_count.order(date: :desc) - respond_with @flights + respond_with(@flights) if stale?(@flights) end # Creates a new Flight for a pilot from the given parameters.