From 6cc53f70f69e658141a449f9db289b79870534f0 Mon Sep 17 00:00:00 2001 From: ChrisBAshton Date: Tue, 12 Jan 2021 08:08:17 +0000 Subject: [PATCH] Fix NoMethodError: undefined method `hour' for 1:Integer We have to `require "active_support/time"` to define these helper methods, which are used to set the Cache-Control header in the [test][] and [development][] environments. I don't know why bumping the govuk_publishing_components gem from v23.10.1 to v23.12.1 has caused this issue in both [Static][] and [Feedback][] (nor why the tests passed on the PR and only subsequently failed after merge). Looking at the Gemfile.lock changes in Static (in 7c79e8dcdd22e88189700dcf8a1d99129532b603), there's no obvious culprit there. I tried reverting the versions of all dependencies except govuk_publishing_components, but the issue remained. Looking at the [diff between the gem versions][diff], there are no code changes that could have caused this, but there are a number of Gemfile.lock changes including a minor bump in `activesupport`, from 6.0 to 6.1, but we've already [upgraded activesupport via a rails bump][rails-bump], so I'm not sure why that would be an issue. It won't be a good use of time to investigate too much further, so I'm happy that this is a harmless change which unblocks us from deploying an important fix. Trello: https://trello.com/c/YhIIykse/2291-3-fix-cross-site-scripting-vulnerabilities [diff]: https://github.com/alphagov/govuk_publishing_components/compare/v23.10.1..v23.12.1 [development]: https://github.com/alphagov/static/blob/8d40903636dba086f855e3f18a99fa02af5055b8/config/environments/development.rb#L23 [test]: https://github.com/alphagov/static/blob/c2b5079b83094b540ad600663fe656a87bb50df9/config/environments/test.rb#L19 [Static]: https://github.com/alphagov/static/pull/2379 [Feedback]: https://github.com/alphagov/feedback/pull/1149 [rails-bump]: https://github.com/alphagov/static/commit/962f64a97c63563ef35b62a3727f770005eeb0f1 --- config/application.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/application.rb b/config/application.rb index 535145958..992772a15 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,6 +4,7 @@ require "action_controller/railtie" require "action_view/railtie" +require "active_support/time" require "sprockets/railtie" require "rails/test_unit/railtie"