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

Upgrade Rails to 7.1.2 and fix signed_id error #135

Conversation

littleforest
Copy link
Contributor

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 an ActionView::Template::Error: Cannot get a signed_id for a new record error. This error occurred since the ActiveStorage::Attachment record was not persisted to the database. In rails/rails#47027, a change was made to raise an error if the record calling signed_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 required title field was added to the Post 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 the ActiveStorage::Attachment record.

closes #134

@Dreamersoul Dreamersoul merged commit 24b0d98 into Dreamersoul:master Nov 18, 2023
1 check passed
@littleforest littleforest deleted the upgrade-rails-7-1-fix-signed-id-error branch November 18, 2023 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaks with Rails 7.1
2 participants