Upgrade Rails to 7.1.2 and fix signed_id error #135
Merged
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.
Background
When upgrading a project that uses this gem to Rails 7.1, an error would occur when a new record that used the
Field::ActiveStorage
field in the Administrate dashboard failed to save, resulting in anActionView::Template::Error: Cannot get a signed_id for a new record
error. This error occurred since theActiveStorage::Attachment
record was not persisted to the database. In rails/rails#47027, a change was made to raise an error if the record callingsigned_id
was not persisted.Changes
This upgrades the test app to Rails 7.1.2, and adds more integration test coverage for the
create
method. To more easily test the case where a record failed to save, a new requiredtitle
field was added to thePost
model. To fix the underlying issue, the code that is responsible for displaying the image preview and a link to the image is wrapped in a conditional that checks for persistence of theActiveStorage::Attachment
record.closes #134