-
Notifications
You must be signed in to change notification settings - Fork 19
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
jcroteau/APPEALS-29633 Fix Deprecation Warning: ActiveRecord::Result#to_hash
has been renamed to to_a
. to_hash
[pre Rails 6.1]
#19553
Closed
jcroteau
wants to merge
2
commits into
master
from
jcroteau/APPEALS-29633-fix-deprecation-warning-active_record-result-to_hash
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jcroteau
changed the base branch from
master
to
DO-NOT-MERGE/rails-6-0-upgrade-plus-bug-and-deprecation-fixes
September 21, 2023 22:18
This comment was marked as off-topic.
This comment was marked as off-topic.
sbashamoni
approved these changes
Sep 27, 2023
jcroteau
force-pushed
the
jcroteau/APPEALS-29633-fix-deprecation-warning-active_record-result-to_hash
branch
from
April 9, 2024 17:50
89057cd
to
cb54d0c
Compare
jcroteau
changed the base branch from
DO-NOT-MERGE/rails-6-0-upgrade-plus-bug-and-deprecation-fixes
to
master
April 9, 2024 18:08
…o_a' Method 'ActiveRecord::Result #to_hash' is deprecated and will be removed in Rails 6.1. It is replaced by '#to_a', which returns the same result.
…test environments.
jcroteau
force-pushed
the
jcroteau/APPEALS-29633-fix-deprecation-warning-active_record-result-to_hash
branch
from
April 9, 2024 18:46
cb54d0c
to
8fe5a98
Compare
There are two tests that consistently fail in CI, however they pass locally and have no apparent relation to the changes made in this PR (which are purely API changes, not behavioral changes): Failures:
1) BgsPowerOfAttorney.find_or_create_by_claimant_participant_id when concurrent calls cause a race condition does not raise an error on unique constraint violation
Failure/Error: find_by(claimant_participant_id: claimant_participant_id)
ActiveRecord::StatementInvalid:
PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
# ./app/models/bgs_power_of_attorney.rb:60:in `rescue in find_or_create_by_claimant_participant_id'
# ./app/models/bgs_power_of_attorney.rb:51:in `find_or_create_by_claimant_participant_id'
# ./spec/models/bgs_power_of_attorney_spec.rb:122:in `block (6 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# PG::UniqueViolation:
# ERROR: duplicate key value violates unique constraint "bgs_poa_pid_fn_unique_idx"
# DETAIL: Key (claimant_participant_id, file_number)=(1129318238, fn) already exists.
# ./app/models/bgs_power_of_attorney.rb:52:in `find_or_create_by_claimant_participant_id'
2) BgsPowerOfAttorney.find_or_create_by_file_number when concurrent calls cause a race condition does not raise an error on unique constraint violation
Failure/Error: find_by(file_number: file_number)
ActiveRecord::StatementInvalid:
PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
# ./app/models/bgs_power_of_attorney.rb:48:in `rescue in find_or_create_by_file_number'
# ./app/models/bgs_power_of_attorney.rb:37:in `find_or_create_by_file_number'
# ./spec/models/bgs_power_of_attorney_spec.rb:184:in `block (6 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# PG::UniqueViolation:
# ERROR: duplicate key value violates unique constraint "bgs_poa_pid_fn_unique_idx"
# DETAIL: Key (claimant_participant_id, file_number)=(1738055, fn) already exists.
# ./app/models/bgs_power_of_attorney.rb:38:in `find_or_create_by_file_number' |
sbashamoni
approved these changes
Apr 22, 2024
Closing due to inactivity as part of our post-PI cleanup effort. Feel free to reopen if this PR is still desired. |
Code Scanning Policy FindingsYour repository contains unresolved code scanning alerts. Policy requires that all code scanning alerts ofcritical severity be resolved within 30 days.In the future, if your repository contains unresolved code scanning alerts older than 30 days, you will not be able to merge this pull request. Learn more about how to triage and remediate these alerts in the GitHub Code Scanning documentation. If this pull request remediates these alerts, after your pull requests CodeQL scan has completed, follow this link to re-run the policy check and select Re-run all jobs at the top of the page: https://github.com/department-of-veterans-affairs/caseflow/actions/runs/8835006858You may also re-run this required check by simply commenting on this pull request with the following command: /actions-bot rerun-required-workflows
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔴 Warning: To be merged into
master
only with or after the Rails 6.0 upgrade (#19261).Resolves https://jira.devops.va.gov/browse/APPEALS-29633
Description
Deprecation Warning
Deprecation Horizon: Rails 6.1
Affected locations
Found in CI / Test
The following locations were identified via
DisallowedDeprecationError
's in CI / Test:index
atapp/controllers/organizations/task_summary_controller.rb:34
counts_by_priority_and_readiness
atapp/models/vacols/case_docket.rb:182
counts_by_priority_and_readiness
atapp/models/vacols/case_docket.rb:201
age_of_n_oldest_genpop_priority_appeals
atapp/models/vacols/case_docket.rb:283
age_of_oldest_priority_appeal
atapp/models/vacols/case_docket.rb:325
distribute_appeals
atapp/models/vacols/case_docket.rb:457
descriptions
atapp/models/vacols/case_issue.rb:106
app/models/concerns/belongs_to_polymorphic_appeal_concern_spec.rb:56
Found by Code Search
/exec_query[\S\s]*to_hash/
/\.to_hash/
ActiveRecord::Result #to_hash
app/models/vacols/case_assignment.rb:162
counts_by_priority_and_readiness
atapp/models/vacols/case_docket.rb:192
age_of_n_oldest_genpop_priority_appeals
atapp/models/vacols/case_docket.rb:298
age_of_oldest_priority_appeal
atapp/models/vacols/case_docket.rb:313
age_of_oldest_priority_appeal
atapp/models/vacols/case_docket.rb:336
age_of_oldest_priority_appeal
atapp/models/vacols/case_docket.rb:369
distribute_appeals
atapp/models/vacols/case_docket.rb:453
app/models/vacols/correspondent.rb:52
lib/tasks/doc.rake:44
Solution
Replace calls to
ActiveRecord::Result #to_hash
with#to_a
.Note: This is only a signature change. The result of
ActiveRecord::Result #to_a
is the same as for#to_hash
.Testing Plan
🔴 Warning: To be merged into
master
only with or after the Rails 6.0 upgrade (#19261).