-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Sentry error "undefined method `any?' for nil" #3549
Conversation
@@ -115,7 +115,7 @@ | |||
padding: true | |||
} %> | |||
|
|||
<% if @content_item.corporate_information_pages.any? %> | |||
<% if @content_item.corporate_information_pages&.any? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe .present?
is more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
dbb660d
to
18eafd4
Compare
@@ -115,7 +115,7 @@ | |||
padding: true | |||
} %> | |||
|
|||
<% if @content_item.corporate_information_pages.any? %> | |||
<% if @content_item.corporate_information_pages&.present? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I somehow missed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
ActionView::Template::Error undefined method `any?' for nil (ActionView::Template::Error) NoMethodError undefined method `any?' for nil (NoMethodError) https://govuk.sentry.io/issues/5249728298/
18eafd4
to
9caaf34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Follow these steps if you are doing a Rails upgrade.
Routes in this application are being migrated to another application, please check with #govuk-patterns-and-pages when making changes.
What
This PR fixes a Sentry error
Why
In preparation for Rails 8 migration, we are checking for the Sentry errors in order to discover any regressions. It turned out this error is not related to the upgrade, but it's easy to fix, so this PR was created.