Skip to content
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 form_for id generation for new CPK models #49069

Merged
merged 1 commit into from Aug 29, 2023

Conversation

gmcgibbon
Copy link
Member

Motivation / Background

This Pull Request has been created because dom ID generation for CPK models is subtly broken.

Detail

This Pull Request changes Action View by adding tests for form_for when using composite primary key models and fixes dom_id output for new CPK models.

Additional information

Every record key casting is either going to be nil or an array, so the code should be safe.

Also, I removed the original CompositePrimaryKeyRecord because it didn't follow the existing pattern of using example-based models in tests. As a result, I updated the test using it to use the new fake CPK model.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Adds tests for form_for use with composite primary key models. Fixes bug
related to new CPK model dom id generation.
@rails-bot rails-bot bot added the actionview label Aug 28, 2023
@eileencodes eileencodes merged commit b1f0efe into rails:main Aug 29, 2023
4 checks passed
@gmcgibbon gmcgibbon deleted the generate_correct_cpk_form_ids branch August 29, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants