Skip to content

Commit

Permalink
Fix NoMethodError: undefined method `hour' for 1:Integer
Browse files Browse the repository at this point in the history
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
7c79e8d), 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]: #2379
[Feedback]: alphagov/feedback#1149
[rails-bump]: 962f64a
  • Loading branch information
ChrisBAshton committed Jan 12, 2021
1 parent 7c79e8d commit 6cc53f7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

require "action_controller/railtie"
require "action_view/railtie"
require "active_support/time"
require "sprockets/railtie"
require "rails/test_unit/railtie"

Expand Down

0 comments on commit 6cc53f7

Please sign in to comment.