You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now when I pass in an update payload that generates an invalid state (as per my Company model's validations) but has a valid, existing, readable logo file, the following error occurs:
ActionView::Template::Error: Cannot get a signed_id for a new record
Failure/Error: <%= image_tag @company.logo.variant(resize: "200x200") %>
ActionView::Template::Error:
Cannot get a signed_id for a new record
This is because the @company.update(...) statement in the controller writes the attributes, but the actual raw saving to the database fails because of validations.
The edit form then tries to display the new, updated but not persisted logo in the frontend, which raises the error about signed_id.
Expected behavior
The edit form should render, with the form showing errors on the name field according to the validators of the company model. Uploading a correct, readable logo should not cause the form to throw an error when rendering.
Actual behavior
The error above is being thrown.
System configuration
Rails version: 7.1.2
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered:
Update: Fixed it for my case. I thought I was using direct-uploads, but I forgot to include the necessary javascript. After I added it, signed_in worked for new records as well. /cc @gregorbg
Steps to reproduce
Say I have a model with an attached image, like such:
...and there is also a controller to update it using the route defined by
resources :companies
like such:The
edit
form is an HTML form that looks as follows:Now when I pass in an update payload that generates an invalid state (as per my
Company
model's validations) but has a valid, existing, readable logo file, the following error occurs:This is because the
@company.update(...)
statement in the controller writes the attributes, but the actual raw saving to the database fails because of validations.The edit form then tries to display the new, updated but not persisted logo in the frontend, which raises the error about
signed_id
.Expected behavior
The
edit
form should render, with the form showing errors on thename
field according to the validators of thecompany
model. Uploading a correct, readable logo should not cause the form to throw an error when rendering.Actual behavior
The error above is being thrown.
System configuration
Rails version: 7.1.2
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: